How-to: ENV - Persistent environment variables for docker apps

How to:

The appcenter now supports adding custom settings to an app with a
file /var/lib/univention-appcenter/apps/$APP_ID/custom.settings.
This file has the same format as the standard appcenter settings file.
This is only possible for apps that are installed as Docker containers and contain app settings.
Bug 55765

Available in:

Package: univention-appcenter
Version: 9.0.7-6A~5.0.0.202304251504
Branch: ucs_5.0-0
Scope: errata5.0-3

Step 1: Create the custom.settings file and put your ENV in it.

For example for the app Keycloak:
cat /var/lib/univention-appcenter/apps/keycloak/custom.settings

[keycloak/new/setting]
Type = String
Show = Install, Settings
InitialValue = @%@hostname@%@.@%@domainname@%@
Scope = inside
Description = new setting

Step 2: List the ENV.

This step checks whether the entries are listed by the system, but they are not yet in the container.

univention-app configure keycloak --list| grep 'new/setting'

Output:
keycloak/new/setting: ‘primary.five.two’ (new setting)

Step 3: Configure and set the ENV

The environment variable can now be configured with a value as.

univention-app configure keycloak --set keycloak/new/setting="foobar"

Step 4: Check the ENV in the container

The following commands are used to check whether the ENV has been accepted in the container.

1. univention-app shell keycloak

2. env| grep NEW_SETT

or

docker exec keycloak env| grep NEW_SETT

Output:
KEYCLOAK_NEW_SETTING=foobar

Mastodon