Configurations
What is a Configuration?
A Configuration is a set of data, settings and any other piece of information your application needs at runtime but cannot be provided as part of your code (at build time) as they:
- depend on environment specifics, e.g. use test data source on QA, but production data on LIVE
- contain secrets, like passwords, private keys, credentials
- vary per region, e.g. APAC, EMEA
- provide control flags, e.g. verbose logging on DEV, but rather restrained on LIVE
... and for many other reasons.
How to set Configuration data?
You can manage Configurations per Stage on the UI, or via the CLI.
Changes on Configurations are persisted in the backend, but do not become active, visible to your application instantly. In order to deploy configuration changes to your application, you need to issue a new Release.
Depending on your application, you might also need to restart its affected Components in order to pick up (reload) configuration changes after a new Release. Pergola does not force a restart if not necessary. This is particularly the case when you deploy a new Release with changed Configuration but keep the same Build and your Components remain unchanged (none of their parameters have been changed).
Example for Web UI
Navigate to your Project on the start page or under the 'Projects' navigation and choose the Stage you want to add the configuration to. Then click on 'CONFIG MANAGEMENT':
If you have no Configuration yet, you need to create one first:
Now add data by clicking the '+ NEW ENTRY' button:
Choose whether you want to add a name/value (e.g. vor ENV variables) pair or a file (e.g. a config.json):
Now, hit 'ADD' and then 'SAVE' and voilà you are done.
The 'NAME' you provide here is the reference (config-ref
) you use within your Project Manifest.
Example for CLI
pergola add config-data my-new-config -p my-new-project -s my-new-stage --env foo=bar --env secret=00111101-00101001 --file /home/silas/config.json
When your config-data is set, you can check it with:
pergola list config-data my-new-config -p my-new-project -s my-new-stage
┌──────────────────────┐
| keys |
| ──────────────────── |
| config.json |
| foo |
| secret |
└──────────────────────┘
or if you want to show the values
pergola list config-data my-new-config -p my-new-project -s my-new-stage --with-values
┌─────────────────────────────────────────────┐
| keys | values |
| ─────────────────────────────────────────── |
| config.json | { |
| | "example": "hello world", |
| | "foo": "bar" |
| | } |
| ─────────────────────────────────────────── |
| foo | bar |
| ─────────────────────────────────────────── |
| secret | UHHKRZIjQ9cz40ALpEtXO556 |
| ─────────────────────────────────────────── |
└─────────────────────────────────────────────┘
The 'key' (e.g. config.json
) you see here is the reference (config-ref
) you use within your Project Manifest.
For further options see CLI reference.
How to deploy a Configuration?
You deploy a Configuration, alongside a Build, by issuing a new Release.
How to delete a Configuration?
Go to your Project and then click on 'CONFIG MANAGEMENT':
Select the Configuration you want to delete and then click on the 'trash' icon:
Once a Configuration is deleted, it is lost irrevocably. There are no backups.