Skip to content

Setting environment variables

Setting environment variables ​

This page explains how to configure environment variables in Shopware PaaS Native.

Sources ​

There are three ways to define environment variables, listed here from lowest to highest priority:

SourceDescription
.env fileCommitted to your repository, lowest priority
application.yamlDefined in app.environment_variables
Vault secretsCreated via sw-paas vault create, highest priority

When the same variable is defined in multiple sources, the higher-priority source wins. For example, a variable set in application.yaml overwrites the same variable from .env, and a vault secret overwrites both.

Use the .env file for defaults, application.yaml for non-sensitive per-environment configuration, and vault secrets for sensitive values like passwords or API tokens. There is a detailed guide for secrets here.

Configure environment variables ​

Environment variables are defined in the app.environment_variables array of your application.yaml file.

Each variable needs a name, value, and scope:

ScopeDescription
RUNThe value is passed to Shopware application (runtime)
BUILDBuild-time environment variables

You can define the same variable name with different scopes to use different values at build-time and runtime.

Once the application.yaml is updated, apply the changes:

sh
sw-paas application update

Example ​

yaml
app:
  environment_variables:
    - name: MY_BUILDTIME_VARIABLE
      value: bar
      scope: BUILD
    - name: MY_RUNTIME_VARIABLE
      value: foo
      scope: RUN
Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)