From d25f5439130a4e81b81425f567ba0bd06baab877 Mon Sep 17 00:00:00 2001 From: Zoltan Papp Date: Fri, 6 Oct 2023 14:37:24 +0200 Subject: [PATCH] Handle idempotent way the encryption key --- infrastructure_files/configure.sh | 4 ++++ infrastructure_files/management.json.tmpl | 1 + 2 files changed, 5 insertions(+) diff --git a/infrastructure_files/configure.sh b/infrastructure_files/configure.sh index 3db799068..ddf865b9e 100755 --- a/infrastructure_files/configure.sh +++ b/infrastructure_files/configure.sh @@ -170,6 +170,10 @@ if [ "$NETBIRD_DASH_AUTH_USE_AUDIENCE" = "false" ]; then export NETBIRD_AUTH_PKCE_AUDIENCE= fi +# Read the encryption key +encKey=$(grep DataStoreEncryptionKey management.json | awk -F'"' '{$0=$4}1') +export NETBIRD_DATASTORE_ENC_KEY=$encKey + env | grep NETBIRD envsubst docker-compose.yml diff --git a/infrastructure_files/management.json.tmpl b/infrastructure_files/management.json.tmpl index e185faa6e..847ce6222 100644 --- a/infrastructure_files/management.json.tmpl +++ b/infrastructure_files/management.json.tmpl @@ -27,6 +27,7 @@ "Password": null }, "Datadir": "", + "DataStoreEncryptionKey": "$NETBIRD_DATASTORE_ENC_KEY", "HttpConfig": { "Address": "0.0.0.0:$NETBIRD_MGMT_API_PORT", "AuthIssuer": "$NETBIRD_AUTH_AUTHORITY",