-
Notifications
You must be signed in to change notification settings - Fork 13
Design Docs
Currently there is no way for an user to set environment variables for their apps if they need to. This feature would enable a new configuration option for the apps, so an user can add, edit, or remove environment variables for an app.
- Add new button in the client frontend that an user can click and then add, edit, or remove environment variables for their app.
- Handle the environment variables modifications through a new API endpoint in the server.
To modify the environment variables for a existing container, we have to recreate the container with the new variables. In summary, the steps are:
-
User presses the edit variables button.
-
The client queries the server for the container existing environment variables.
-
Server queries docker to inspect the container and get the container info back.
-
Server filters out the default environment variables like
NODE_ENV
andPORT
, then returns the filtered variables.
- The app environment variables are stored inside the container config file generated by Docker (API reference). For example:
"Env": [ "NODE_ENV=production", "PORT=3000", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "NODE_VERSION=14.9.0", "YARN_VERSION=1.22.5" ],
-
-
The client shows the input fields to insert or edit the environment variables.
- Display in the same page, modal, or in a new page?
-
User presses the update button to send the new environment variables to the server.
-
If the container is running, warns the user to confirm that the app will be restarted and asks if it's OK.
-
The server stops and removes the existing container.
-
The server recreates the container with the new environment variables and starts the container.