Skip to content

Environment Variables

Environment variables let you pass configuration values, secrets, and connection strings to your application without hardcoding them in your source code. In Appliku, there are several ways to manage them.

Setting Variables Manually

In the Appliku dashboard, go to Application Settings > Environment Variables tab.

Add variables as key-value pairs:

DATABASE_URL=postgres://user:pass@host:5432/dbname
SECRET_KEY=my-secret-key
DEBUG=false

Click Save to store the variables. They take effect on the next deployment or restart.

To apply them right away, use Save and Deploy (full build) or Save and Restart (no build: runtime values only; variables used during the build keep their old values, see Build-time and runtime variables).

Auto-Injected Variables

From Databases

When you provision a database and attach it to your application, Appliku automatically sets connection environment variables:

  • connection_url -- the full connection URL accessible from the public network
  • private_connection_url -- the connection URL using the server's internal network (lower latency, no external traffic)

The variable names are prefixed with the database type (e.g., DATABASE_URL, REDIS_URL).

From Domains

Appliku automatically sets a variable containing a comma-separated list of all custom domains attached to your application. This is useful for frameworks that need to know their allowed hosts.

Import and Export

You can import environment variables from a .env file format, or export your current variables in the same format. This is convenient for:

  • Migrating configuration from another platform
  • Sharing configuration between environments
  • Backing up your variables locally

Configuration via appliku.yml

Environment variables can also be defined in your appliku.yml file. Variables set in the YAML file are applied on each deployment.

Build-time and Runtime Variables

Your variables reach the application in two ways:

  • At runtime. On every deployment and restart, Appliku writes the variables to an env file that the processes load when they start. Processes with "application environment variables" turned off do not get them. Per-process variables and the generated PORT are added on top.
  • During the build. Appliku's predefined Dockerfiles source envs_export.sh before the build command runs (see Predefined Dockerfiles), so the build command, collectstatic and frontend bundlers can read the variables. If you use your own Dockerfile, it decides this itself.

A restart changes only the runtime values. Anything computed during the build keeps the values from build time: static files, frontend bundles that inline variables such as NEXT_PUBLIC_*, VITE_* or REACT_APP_*, and generated configuration. To change those, run a full Deploy.

The image also contains a copy of /env/envs_export.sh from build time, and a restart does not update that copy. Read variables from the process environment, not from that file.

Masking

Variable values are masked in the dashboard UI by default. Click the reveal button to view a value. This prevents accidental exposure of secrets when sharing your screen or taking screenshots.

Precedence

When the same variable is defined in multiple places, the following precedence applies during deployment:

  1. Volume environment variables (highest priority) -- variables injected from volumes override other sources during deployment
  2. Dashboard variables -- manually set variables and auto-injected variables

Volume environment variables override manual variables during the deployment process but do not remove or modify the values stored in the Environment Variables tab. The tab always reflects what you have set manually and what has been auto-injected.

Best Practices

  • Use environment variables for all secrets (API keys, database passwords, tokens)
  • Keep a .env.example file in your repository documenting required variables without real values
  • Use private_connection_url for database connections when the database is on the same server to avoid unnecessary network hops