Skip to content

Design Docs

Guilherme Gwadera edited this page Sep 7, 2020 · 5 revisions

Set Environment variables for an app

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.

Goals

  • 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.

Design

To modify the environment variables for a existing container, we have to recreate the container with the new variables. In summary, the steps are:

  1. User presses the edit variables button.
  2. The client queries the server for the container existing environment variables.
    • The app environment variables are stored inside the container config file generated by Docker.
    1. Server queries docker to inspect the container and get the container info back.
    2. Server filters out the default environment variables like NODE_ENV and PORT, then returns the filtered variables.
  3. The client shows the input fields to insert or edit the environment variables.
    • Display in the same page, modal, or in a new page?
  4. User presses the update button to send the new environment variables to the server.
  5. If the container is running, warns the user to confirm that the app will be restarted and asks if it's OK.
  6. The server stops and removes the existing container.
  7. The server recreates the container with the new environment variables and starts the container.
Clone this wiki locally