Skip to main content

Setting environment variables

You might want to configure extra environment variables that will be passed to the app at runtime, such as database credentials.

Set environment variables on app creation

You can specify env variables on app creation with nctl using the --env flag:

--env=KEY=VALUE;...    Environment variables which are passed to the app at runtime.

$ nctl create app rails-example --env=RAILS_ENV=dev

Multiple environment variables can be added by using the --env option multiple times or by using a semicolon to separate them:

$ nctl create app rails-example --env=RAILS_ENV=dev --env=MAIL_USERNAME=test
$ nctl create app rails-example --env='RAILS_ENV=dev;MAIL_USERNAME=test'

Updating environment variables

On existing applications you can use nctl update app to set new environment variables or change the values of already set ones.

$ nctl update app rails-example --env=RAILS_ENV=prod

To delete existing environment variables you can use the --delete-env flag

$ nctl update app rails-example --delete-env=RAILS_ENV

Listing the set environment variables

To see the currently set environment variables, you can use the nctl get app command and specifying the yaml output format.

$ nctl get app rails-examle -o yaml

kind: Application
apiVersion: apps.nine.ch/v1alpha1
metadata:
name: rails-example
...
spec:
forProvider:
config:
env:
- name: MAIL_USERNAME
value: produser
...