Environment variables
Keep keys, tokens, and passwords out of your repository by setting them per environment on the Code tab.
Environment variables hold the values your code needs but your repository should not: API keys, tokens, passwords, and settings that differ between live and staging. Open your site, then Code, and find environment variables for the environment you are looking at.
Variables are per environment. A variable you set on staging does not exist on live, so you can point staging at a test payment account and live at the real one.
Add a variable
- Open your site, then Code.
- Open environment variables.
- Enter the name and the value.
- Mark the variable as secret if the value should never show again.
- Save.
Avaloi applies the change through a job. The new value is in place on the next build or restart.
Secret values
A secret value is masked after you save it. The list shows the name and a masked value, and the API returns the same. To change a secret, set it again with the new value. Nobody can read the old one back, including you.
Change or delete a variable
Set a variable again to change its value. Delete a variable you no longer need. Each change applies through a job and takes effect on the next build or restart.
Defaults that are safe to share
Values that are safe to share, such as a feature flag or a public URL, can live in the env section of avaloi.yml instead. They travel with the repository and apply to every environment that builds from it. Keep secrets out of avaloi.yml and set them here.
Quick answers
I changed a variable, but my site still uses the old value. The change takes effect on the next build or restart. Deploy, or restart PHP from Tools.
Can I read a secret value after saving it? No. Secret values are masked after saving. Set the variable again if you need a new value.
Do variables copy to a new environment? Variables are per environment. Set them on each environment that needs them.
Where does wp-config.php get its settings?
Avaloi writes wp-config.php for each environment. It is never in Git.
API
GET /v1/environments/{id}/env-varsPUT /v1/environments/{id}/env-varsDELETE /v1/environments/{id}/env-vars
Related
Still stuck?
Email [email protected] with your site name and what you tried, or send us a message.