Environment variables are runtime configuration values your application reads from the container’s environment. On the Stack Harbor PaaS, two kinds matter:
- Default variables — set by the platform on every container in a given stack. Some are read-only platform internals; others are editable knobs that change container behaviour (memory caps, port redirection, Java GC, package manager selection, and similar).
- Custom variables — values you add yourself for the application to read. The dashboard exposes a per-container variables panel, and there are equivalent ways through shell config files or, for Java, through
variables.conf.
Both work the same way at runtime — your code reads $VAR_NAME and gets the value. The difference is who put the value there: the platform, or you.
What this section covers
- Default environment variables — the full list of platform-set variables, grouped by stack. Includes what each variable does, whether it is editable, and what value the platform defaults to.
- Custom environment variables — three ways to add your own variables: the dashboard panel, shell configuration files, and (for Java)
variables.confwith the configuration file manager.
When to edit what
- Use the dashboard variables panel for application configuration the platform should preserve across container restarts and rebuilds. This is the canonical surface.
- Use shell config files (
~/.bashrc) only when the variable needs to exist for interactive shell sessions and you do not want it visible in the dashboard. The platform sources~/.bashrcfrom~/.bash_profileautomatically. - Use
variables.conffor Java application servers when the value should reach the JVM as a-Dflag — this is where Java options live.