18.01.2020 Views

Working with Linux

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Autoenv – Set a lasting, project-based habitat

Projects are different from one another and so are environments. We might be developing an

application on our local machine with certain environment variables like debug level, API keys, or

memory size. Then we want to deploy the application to a staging or production server, which has

other values for the same environment variables. A tool that comes in handy for loading environments

on the fly is autoenv.

To install it we go to the official GitHub page and follow the instructions:

https://github.com/kennethreitz/autoenv

First we will clone the project in our home directory, and then we add the following line to our .zshrc

config file, so that every time zsh starts, autoenv is loaded by default:

source ~/.autoenv/activate.sh

Now let's create an example workplace with two imaginary projects, project 1 and project 2.

We open an environment file for project 1:

vim project1/.env

Let's now imagine that project 1 uses an environment variable called ENV, which we will set to dev:

export ENV=dev

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!