Configuration provider
The configuration provider add-on helps you to create groups of environment variables that you can share with multiple applications.
Example
Let’s take an example with 2 Node.js applications exposing some REST APIs: shipping-api
and payment-api
.
The shipping-api
application needs the following environment variables:
PULSAR_TOPIC=order
USER_API_HOST=https://user.example.com/api
ENABLE_PARTNERS=true
The payment-api
application needs the following environment variables:
PULSAR_TOPIC=order
USER_API_HOST=https://user.example.com/api
ENABLE_SEPA=false
As you can see, we had to define PULSAR_TOPIC
and USER_API_HOST
in both applications with the same value.
If we ever need to change these values, we’ll have to apply the updates in both apps and restart them.
NOTE: This is a simple example, but we could have more than just 2 microservices and more than just 2 common variables.
To simplify this process, we will create a configuration provider add-on. It will allow us to define those common variables in one place and inject them in our 2 applications.
Think of a configuration provider as a way to group a set of environment variables and share them with any application.
If a variable is defined in a configuration provider and also in the application, the value defined in the application wins.
How to create a config provider
In the console, go to the organisation where you have your applications.
- Click on Create and then on an add-on
- You will see a list of add-ons, select Configuration provider
- Select the first plan and click on Next
- Toggle the Link for each application you need and then on Next
- Define a name and click on Next
Once you have your configuration provider, you can set the variables in the form. You can find out more about rules and format in this page.
Details and behaviour
- As with any other add-on, you can only link a configuration provider to applications that are in the same organisation.
- Variables defined directly in the application override the ones injected from the configuration provider.
- When you update the variables of a configuration provider, all applications linked to it will be automatically restarted.
- You can create multiple configuration providers in your organisation and link them to different applications.
Pricing
This add-on is completely free. No fee will be invoiced to you while using this kind of add-on.
Did this documentation help you ?