Build & Deploy
Config Files

Config Files

Use config files to inject configuration files, certificates, or other files into your Koyeb Services. Files are copied into the Service at runtime and can be accessed by your application.

Each config file has the following components:

  • Path: The path where the file is copied to in the Service. The path must be an absolute path and can include subdirectories. For example, /etc/nginx/nginx.conf.
  • Content: The value that will be given when the variable is accessed. The value can be a plaintext value, or leverage interpolation to reference Secrets, a Koyeb-provided variables, or other environment variables.
  • Permissions: The permissions that will be set on the file. The default is 0644.

Managing files

You can define file path or modify file content using either the Koyeb control panel (opens in a new tab) or the Koyeb CLI.

When using the Koyeb control panel, you can manage files for your Service on the Service configuration screen. This screen is accessible both during your initial Service configuration and later in your Service's Settings tab.

From the Settings tab, expand the Environment variables and files section and select Files tab.

To add a new file, click Add file. Set File content and set Path.

To modify a file, edit the File content, or Path.

To delete a file, click the trash icon associated with the file line.

Using environment variable and Secret interpolation as part of your file content

Koyeb supports environment variable interpolation and will replace all environment variable references included in the file content with their respective values during deployment.

To reference the value of an environment variable, use the following syntax:

{{ <ENV_NAME> }}

For example, here is an example of a file content that references the value of the STORAGE_REGION environment variable:

endpoint=https://storage.{{ STORAGE_REGION }}.provider.com

With the environment variable defined as STORAGE_REGION=eu-central-003, the file content will be:

endpoint=https://storage.eu-central-003.provider.com

To use content of a Koyeb Secret, use the following syntax:

{{ secret.<SECRET_NAME> }}

For example, to use a Secret called POSTGRESQL_PASS, add the following value:

{{ secret.POSTGRESQL_PASS }}
đź’ˇ

Note: References to undefined variables will be replaced by a blank string during processing.

Updating an environment variable or a secret at runtime will not change the content of file that reference it. Koyeb only processes environment variables for interpolation during the actual deployment and will not re-evaluate variables based on later changes.

Accessing environment variables at build time

For now, accessing config files is supported only at runtime. You can't access config files during the build process.

File permissions and ownership

When setting a config file, you can specify the permissions that will be set on the file. The default permissions are 0644. For now permission can be set only using the Koyeb CLI or the API.

The file will be owned by the user running the app. The user and group are determined by the base image of the app. For example, if you are using the nginx base image, the file will be owned by the nginx user and group.