Environment variables are user defined key-value pairs that can configure the behaviour of applications at runtime. Common ways they are used are for storing things like API keys, username/passwords, JVM runtime options, locale, etc.
You can use the commands env
or printenv
to check the environment variables set and if you are not happy with the variables set at the Container creation time you can update these variables at any time.
The steps to add new key-value pairs follows:
To remove environment variables, do the following:
The container will be restarted for the environment variable changes to take effect.
This is actually much easier than it sounds as Silverstripe already supports this out of the box. Simply add the environment variables Silverstripe is looking for through the SiteHost Control Panel, and the framework will take care of the rest.
This should be sufficient to get a simple Silverstripe site up and running:
The environment variables loaded here will have priority overy any included in the .env
file, so there should no conflicts when setting this up. If you have all the variables Silverstripe needs here you can even do away with the .env
file alltogether!