From bcf9cc9c5f401419498e44fe7484b6ed3b2b04c3 Mon Sep 17 00:00:00 2001 From: Florian Spreckelsen <f.spreckelsen@indiscale.com> Date: Thu, 24 Oct 2024 12:04:01 +0200 Subject: [PATCH] MAINT: Environment variables match LINKAHEAD_CONFIG_* now. --- CHANGELOG.md | 2 ++ README_CONFIGURATION.md | 2 +- src/doc/administration/configuration.rst | 4 ++-- src/main/java/org/caosdb/server/ServerProperties.java | 11 ++++++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e73bf69f..38dba755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +* Environment variables match `LINKAHEAD_CONFIG_*` now (instead of `CAOSDB_CONFIG_*`). + ### Deprecated ### Removed diff --git a/README_CONFIGURATION.md b/README_CONFIGURATION.md index 27045eea..06b36ebd 100644 --- a/README_CONFIGURATION.md +++ b/README_CONFIGURATION.md @@ -9,7 +9,7 @@ The default configuration can be overriden by 1. the file ./conf/ext/server.conf 2. any file in ./conf/ext/server.conf.d/ in (approximately?) alphabetical order -3. environment variables with the prefix `CAOSDB_CONFIG_` +3. environment variables with the prefix `LINKAHEAD_CONFIG_` in this order. diff --git a/src/doc/administration/configuration.rst b/src/doc/administration/configuration.rst index c91ac16b..7dd0b49c 100644 --- a/src/doc/administration/configuration.rst +++ b/src/doc/administration/configuration.rst @@ -16,7 +16,7 @@ with a hash (`#`). Key-value lines must have the format `KEY_NAME=VALUE` or The server default configuration is located at `./conf/core/server.conf`. Upstream defaults are stored here. The possible configuration options are documented inside the -`default file <https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/blob/dev/conf/core/server.conf>`__. +`default file <https://gitlab.com/linkahead/linkahead-server/-/blob/dev/conf/core/server.conf>`__. User specific configuration should be in `./conf/ext/` and override settings in `./conf/core/`. @@ -27,7 +27,7 @@ The default configuration can be overriden by 2. any file in ./conf/ext/server.conf.d/ in (approximately?) alphabetical order - 3. environment variables with the prefix `CAOSDB_CONFIG_` + 3. environment variables with the prefix `LINKAHEAD_CONFIG_` in this order. diff --git a/src/main/java/org/caosdb/server/ServerProperties.java b/src/main/java/org/caosdb/server/ServerProperties.java index 93a0c747..8789a563 100644 --- a/src/main/java/org/caosdb/server/ServerProperties.java +++ b/src/main/java/org/caosdb/server/ServerProperties.java @@ -186,8 +186,17 @@ public class ServerProperties extends Properties implements Observable { // load env vars for (final java.util.Map.Entry<String, String> envvar : System.getenv().entrySet()) { + if (envvar.getKey().startsWith("LINKAHEAD_CONFIG_") && envvar.getKey().length() > 17) { + serverProperties.setProperty(envvar.getKey().substring(17), envvar.getValue()); + } if (envvar.getKey().startsWith("CAOSDB_CONFIG_") && envvar.getKey().length() > 14) { - serverProperties.setProperty(envvar.getKey().substring(14), envvar.getValue()); + logger.warn( + "Environment variables start with LINKAHEAD_CONFIG_ now (instead of the old " + + "CAOSDB_CONFIG_). Consider renaming: " + + envvar.getKey() + + " ( = " + + envvar.getValue() + + " )"); } } -- GitLab