4. Environments
The configuration files in Nekonote Framework are separated by each of Environments.
You may declare that which environment should be used by declaring a shell variable called NAKONOTE_ENV
.
Checking The Current Environment
You can see the current environment by typing nekonote env
on your terminal.
But the result will say ‘Missing Environment’. That’s because the shell variable NAKONOTE_ENV
is not set in your shell.
Declaring The Environment
You need to set some environment for your application by defining a shell variable called NEKONOTE_ENV
.
Typically, you can set it by the following command export NEKONOTE_ENV=development
.
It will be conforable if NEKONOTE_ENV
is set automatically. You may run echo "NEKONOTE_ENV=development" >> ~/.bash_profile
for it if your shell is bash.
If your shell is not Bash, please change the above commands in accordance with your shell.
Showing Environments
After generating application structure, the structure has an environment named ‘development’.
You can see the list of the existing environments by typing ls /path/to/app/root/preference/
on your shell.
I guess you will find just one environment named ‘development’.
Please replace /path/to/app/root
to the actual path to your application strcuture.
Creating Environments
There is a command to create a new environment:
on terminal
nekonote new env staging --root /path/to/app/root
Success!
Created a new environment 'staging' on the application /path/to/app/root/my-project/
Note:
In order to use the environment you created, you need to set 'staging' to a shell variable called NEKONOTE_ENV.
# see available environments
ls /path/to/app/root/preference
development staging
When you type the command in application root, there is no need to give --root
option.
After that, your application will be having the environment named staging
.
The way to switch the environment to staging
is running export NEKONOTE_ENV=staging
.
on terminal
# change the current environment
export NEKONOTE_ENV=staging
# display the current environment
nekonote env
staging
It’s ok to type NEKONOTE_ENV=staging
to specify some environment like following NEKONOTE_ENV=staging nekonote server start
.