Environment Variables - Kool Cloud

Most applications and frameworks nowadays rely on environment variables to configure important aspects of their functions, mainly providing credentials and other secrets your app needs to work and access other resources.

Kool.dev Cloud supports a few different ways you can define your environment variables for a deploying container, so pick the one that best suits you.

kool.deploy.env should be a .env formatted file. You can point to it like this:

services: app: # ... environment: kool.deploy.env

Upon deployment, all of the variables within that file will be parsed, placeholders replaced—if you have any—and then each variable will become a real environment variable in the running container.

This option is usually best suited for automated CI routines since you work your way to have a different kool.deploy.env file for each of your deploying environments (i.e., staging and production).

services: app: # ... environment: FOO: bar

You can simply use a YAML map of values that will become your environment variables in the running deployed container. This is handy sometimes when you have simple and not sensitive variables you want to add to a container for deploy.

If your application does rely on and requires a .env file existing in the running container, you may achieve so by using the env: entry:

services: app: # ... # 'env' is a different option that allows you to build a file inside your running container. env: source: kool.deploy.env target: .env

This is useful for apps that require the .env file, but you do not wish to have that built into your Docker image itself.

kool.dev
By choosing "Accept all cookies" you agree to the use of cookies to help us provide you with a better user experience and to analyse website usage. Only the essential cookies are necessary for the proper functioning of our website and cannot be refused.
Check out our Cookie Policy and Privacy Policy for more information.