You can save variables within your project at different levels. Variables can be added as strings or base64-encoded JSON-serialized values within the system, at project or environment level.
The following table defines what types of variables are available to you:
Type | Definer | Scope | Precedence | Build | Runtime | Uses |
---|---|---|---|---|---|---|
Application | Application | Application | 4 | Yes | Yes | Non-secret values that are the same across all environments |
Project | User | Project | 3 | Yes | Yes | Secret values that are the same across all environments, such as database credentials |
Environment | User | Environment | 2 | Some | Yes | Values that vary by environment, such as which database to connect to or which payment API keys to use |
Platform.sh | Pre-defined | Environment | 1 | Some | Yes | For information about your Platform.sh project |
If there are conflicts between variables with the same name, variables take precedence from 1 down. So Platform.sh-provided values (1) override environment variables (2), which override project variables (3), which override application-provided variables (4).
All of the variables can also be overridden via a script.