Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After the Flink configuration has been parsed from the file, environment variables (following a clearly defined naming schema, see below) are taken into consideration and are allowed to amend or even replace the parsed configuration. Allowing environment variables to take precedence over the configured values is a deliberate and important choice.

Compatibility, Deprecation, and Migration Plan

...

For example, with an environment

Code Block
KEY_A="Environment=A"
KEY_B="Environment=B"

and a configuration file

Code Block
key.a: File=A
key.c: File=C

the resulting, effective configuration would be equivalent to a configuration of 

Code Block
key.a: Environment=A
key.c: File=C
key.b: Environment=B

Naming of environment variables

A key limitation is that environment variables cannot be enforced to be named exactly like their configuration key counter-part. This stems from two reason:

  1. Some systems / shells do not support "." or "-" in variable names.
  2. Environment variables are idiomatically named using uppercase (e.g., $HOME and not $Home or $home), and are actually case-sensitive.

Due to this, a convention needs to be established on how configuration keys are looked up in the environment. We propose that each configuration key (example: key.A-b ) is looked up in the following ways and order, stopping if any yield a match:

  1. key.A-b  (no change)
  2. key_A-b  (periods → underscores)
  3. key.A_b  (hyphens → underscores)
  4. key_A_b  (periods + hyphens → underscores)
  5. KEY.A-B  (uppercase)
  6. KEY_A-B  (uppercase, periods → underscores)
  7. KEY.A_B  (uppercase, hyphens → underscores)
  8. KEY_A_B  (uppercase, periods + hyphens → underscores)

As motivated earlier, this follows the same specification as Spring.

Compatibility, Deprecation, and Migration Plan

No impact on existing users is expected. Hypothetically, if the environment happens to include a variable with a matching name, this change would cause a change in behavior. We consider this risk to be negligibly low, however.

...

Test Plan

Describe in few sentences how the FLIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?

Rejected Alternatives

...

Initially, we also discussed a substitution solution where users modify their Flink configuration to use an environment variable substitution syntax such as 

Code Block
key.a: ${ENV_VAR_A}
key.b: ${ENV_BAR_B} ms


This approach has been rejected for several reasons:

  1. It changes the syntax of the configuration and would require additional details to be added to the syntax, i.e. to define default/fallback values and to escape variables so that they are not replaced.
  2. It requires the introduction of a new set of environment variables users have to memorize.
  3. If users want full flexibility to override any value, a configuration file would have to be maintained which simply maps all keys to some environment variable.