Environment variables
Environments variables are used to add parameters to your containers dynamically. Strio allows you to add environment variables when configuring a container. Some variables are generated automatically by Strio when you deploy an environment. You can also explicitly add custom environment variables. Each environment variable has a name and a value.
Let’s dig into that!
Inherent environment variables
No matter the configuration of the environment that you deploy, Strio will automatically generate a few environment variables for this environment. Those variables are available to any component of the environment.
Here is the list of those variables:
Name | Value example | Description |
---|---|---|
STRIO_ENVIRONMENT_NAME |
STRIO_MY_NEW_ENV |
Environment's name |
STRIO_ENVIRONMENT_URL |
https://app.strio.co/my.service/my.env | URL to access the environment dashboard on Strio's app |
Automatically generated environment variables
Environment variables will be generated automatically by Strio according to the configuration of your environment - especially containers and dependencies.
Those variables will be available to any component of the environment.
Here’s the list of the environment variables automatically generated for the containers and the dependencies.
For containers:
Name | Description |
---|---|
STRIO_<CONTAINER_NAME> |
Container's name within Kubernetes - can be used by another container to connect with it. |
STRIO_<CONTAINER_NAME>_PORT_<port> |
External URL of the port |
<CONTAINER_NAME>
represents the name that you gave to your container.
For dependencies:
Name | Description |
---|---|
STRIO_<DEPENDENCY_NAME>_HOST |
Main URL of the dependency |
STRIO_<DEPENDENCY_NAME>_USER |
Admin username of the dependency |
STRIO_<DEPENDENCY_NAME>_PASSWORD |
Admin password of the dependency |
<DEPENDENCY_NAME>
represents the name that you gave to your dependency.
Custom variables
Finally you can add any environment variable your service might need. You can assign any coherent value to it. You just need to specify them on the web interface.
How to use environment variables
Environment variables are used to add parameters to your containers. Here are two common use cases.
Use automatically generated variables to add value to custom environment variables.
For example, imagine your service has a MongoDb dependency name my_database. If your container has an environment variable DATABASE
which is supposed to store the URL of the database, you will add this in the configuration panel:
Name | Value |
---|---|
DATABASE |
STRIO_MY_DATABASE_HOST |
Define a custom variable and add a value to it.
For example if you want to start the debugging mode you can add in the configuration panel:
Name | ValueD |
---|---|
DEBUGGING_MODE |
TRUE |