Skip to content

tradologics/setenv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

setenv

Manage .env files for various GitHub projects.

1. Setup

You'll need an access token as described in this GitHub Help article.

1. Download setenv.sh (bash file) and place it in /usr/local/bin/setenv as an executable file:

$ cd <FILE-LOCATION>
$ chmod +x ./setenv.sh
$ mv ./setenv.sh /usr/local/bin/setenv
  1. Edit .bashrc to include your "env" repository (make it private!) and your token:
export ENV_REPO=<USERNAME>/<ENV-REPO>
export ENV_TOKEN=ghp_v4v78d73f9a03a694f1ca8f3488911ec2ec3

2. Create .env files

For every project, create its .env file for a GitHub repository as user/repo. For example:

  1. For the GitHub project someproj for user someuser, create a file named someuser/someproj.
  2. For the GitHub project yourproj for your user (aka youruser), create a file named youruser/yourproj.

3. Use

To fetch your project .env file, run setenv inside the project directory on your server or local machine before running your project.

For example:

$ cd yourproj
$ setenv && npm start

This will fetch the latest data github.com/yourproj/setenv-repo/yourproj/yourproj and place it in .env.

4. Variations

You can also explicitly use variations of your .env file by creating adding a postfix and specifing it when running setenv.

For example, to use youruser/yourproj-prod, run:

$ cd yourproj
$ setenv prod && npm start

To use youruser/yourproj-stage, run:

$ cd yourproj
$ setenv stage && npm start

Etc.

5. Clear

To clear the working .env file, run:

$ setenv --clear

Enjoy!

About

Manage .env file secrets for GitHub projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages