Configurations
Overview
Module
- package:
org.eclipse.dirigible.sdk.core - source: core/Configurations.java
Reads platform configuration values through the Dirigible Configuration layer — the same source the rest of Dirigible consults for DIRIGIBLE_* env vars, application*.properties entries, and runtime overrides. Use this rather than System.getenv(String) so the precedence rules (env > property file > default) apply consistently with the rest of the platform.
For lists of supported keys see DirigibleConfig in modules/commons/commons-config; that enum is the canonical inventory.
Key Features
- Unified precedence: Reads from env vars, property files, and runtime overrides in the same order the rest of Dirigible does.
- Static API: All methods are
public static— no instance needed. - Mutable at runtime:
setandremoveadjust the live configuration for the JVM. - Default value fallback: The two-arg
getreturns a caller-supplied default when the key is absent.
Example Usage
import org.eclipse.dirigible.sdk.core.Configurations;
// Read with a default fallback
String endpoint = Configurations.get("DIRIGIBLE_API_ENDPOINT", "https://localhost:8080");
// Probe whether a key is set
if (Configurations.has("DIRIGIBLE_FEATURE_BETA")) {
// ...
}
// Override at runtime
Configurations.set("MY_APP_REGION", "eu-central-1");
// Remove a key
Configurations.remove("MY_APP_REGION");Methods
get()
Retrieves the configuration value associated with the given key. Returns null if the key is not set.
javapublic static String get(String key);
Parameter Type Description keyStringThe configuration key. Returns
- Type:
String- Description: The configuration value, or
nullif the key is not set.
get() with default
Retrieves the configuration value associated with the given key, returning a caller-supplied default when the key is not set.
javapublic static String get(String key, String defaultValue);
Parameter Type Description keyStringThe configuration key. defaultValueStringThe value to return if the key is not set. Returns
- Type:
String- Description: The configuration value, or
defaultValueif the key is not set.
has()
Reports whether a configuration value is set for the given key.
javapublic static boolean has(String key);
Parameter Type Description keyStringThe configuration key. Returns
- Type:
boolean- Description:
trueif the key resolves to a non-null value,falseotherwise.
set()
Sets or overwrites the configuration value for the given key at runtime.
javapublic static void set(String key, String value);
Parameter Type Description keyStringThe configuration key. valueStringThe value to set. Returns
- Type:
void
remove()
Removes the configuration entry associated with the given key.
javapublic static void remove(String key);
Parameter Type Description keyStringThe configuration key to remove. Returns
- Type:
void