For developers
Sensitive environment variables
3 min
for security reasons, it's important to keep sensitive data, like access keys or security tokens, outside the code repository hosty is no ui hosting blueprint, therefore there's no interface to add sensitive environment variables however, hosty has a recommended approach to deal with sensitive data hosty assumes that deployments are handled in ci/cd configuration docid\ bhyixwy8txq6fdw2xbpdw , like circleci or similar these tools have mechanism to add environment variables and store them on their side then, during a deployment job in ci, there must be a step to create a env file (the name can be different, but it's important to stick to the dotenv like file structure) the last step is to configure hosty to load environment variables from it let's look it each step is a bit more detail step 1 add environment variables to your ci platform step 2 add a step to add environment variables to a env file the name of the file with secrets can be any, as long as it follows dotenv file format circleci/config yml run name create a file with sensitive environment variables command | echo "forecast account id=$forecast account id" >> env secrets echo "forecast api key=$forecast api key" >> env secrets echo "harvest account id=$harvest account id" >> env secrets echo "harvest api key=$harvest api key" >> env secrets step 3 tell hosty yaml to load environment variables from the file for each application container, you can specify an optional parameter environmentfiles with the list of the dotenv formatted files containing environment variables for the container here's an example for the php container hosty yaml applications backend \# php \# explicitly defined environment variables environmentvariables backend url "https //{{ node host 0 }}" application mode development \# tell hosty to load the file with environment variables \# generated in the previous build step environmentfiles \ / env secrets hosty will load environment variables from the file and make them available in the deployed container (in this particular example php container)