java.lang.Object
io.helidon.config.EnvironmentVariableAliases
Provides configuration key aliases in an attempt to map to legal environment variable names.
The
MP config specification describes the environment variables ConfigSource
as follows:
Some operating systems allow only alphabetic characters or an underscore, _, in environment variables. Other characters such as ., /, etc may be disallowed. In order to set a value for a config property that has a name containing such disallowed characters from an environment variable, the following rules are used. This ConfigSource searches 3 environment variables for a given property name (e.g. com.ACME.size): 1. Exact match (i.e. com.ACME.size) 2. Replace the character that is neither alphanumeric nor _ with _ (i.e. com_ACME_size) 3. Replace the character that is neither alphanumeric nor _ with _ and convert to upper case (i.e. COM_ACME_SIZE)
Since Helidon supports many hyphenated configuration keys (e.g. "server.executor-service.max-pool-size"
),
an additional mapping is required to produce aliases that can be expressed as environment variable names (e.g.
"SERVER_EXECUTOR_dash_SERVICE_MAX_dash_POOL_dash_SIZE"); see aliasesOf(String)
for details.
-
Method Summary
-
Method Details
-
aliasesOf
Returns a list of aliases for the given config key.If the key does not contain any
'-'
(dash) characters, all disallowed characters are replaced by'_'
(underscore) and this plus the uppercase variant are returned. For example,"app.qualifiedName"
and"app/qualifiedName"
both result in the same two aliases:- "app_qualifiedName"
- "APP_QUALIFIEDNAME"
'-'
(dash) characters, they are replaced by"_dash_"
and by the uppercase variant so that, e.g.,"app.page-size"
results in three aliases:- "app_page_dash_size"
- "APP_PAGE_dash_SIZE"
- "APP_PAGE_DASH_SIZE"
- Parameters:
key
- The configuration key.- Returns:
- The list of aliases.
-