public class EnvironmentVariableAliases extends Object
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.
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
aliasesOf(String key)
Returns a list of aliases for the given config key.
|
public static List<String> aliasesOf(String 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:
'-' (dash) characters, they are replaced by "_dash_" and by the
uppercase variant so that, e.g., "app.page-size" results in three aliases:
key - The configuration key.Copyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.