Configuration Providers

This extension includes two built-in providers that read flag values from Quarkus configuration. These are useful for development, testing, or simple deployments where flags are known at build time or runtime. For production use with dynamic flag evaluation, consider a dedicated provider such as flagd or Unleash.

Runtime configuration provider

The runtime configuration provider reads flag values from Quarkus runtime configuration. Values can be overridden at deploy time using environment variables, system properties, or external config files, as described in Quarkus Configuration documentation.

Add the dependency:

<dependency>
    <groupId>io.quarkiverse.openfeature</groupId>
    <artifactId>quarkus-openfeature-runtime-config</artifactId>
    <version>1.0.0</version>
</dependency>

Define flags in application.properties:

quarkus.openfeature.runtime.new-feature=true
quarkus.openfeature.runtime.greeting=hello
quarkus.openfeature.runtime.max-retries=3
quarkus.openfeature.runtime.max-bytes=10000000000
quarkus.openfeature.runtime.threshold=0.75

Values are written as strings, so the type of a flag is inferred from its value. The narrowest type that holds the value exactly wins: true and false are booleans, a whole number is an integer or, if it doesn’t fit, a long, and any other number is a double. A JSON object or array is a structure, and everything else is a string.

Structured flags are therefore written as JSON:

quarkus.openfeature.runtime.limits={"max":10,"enabled":true}
quarkus.openfeature.runtime.regions=["eu","us"]

A flag can be evaluated as a type other than the inferred one:

Boolean evaluation

Throws an error unless the flag is a boolean, that is, unless its value is true or false (case insensitive).

Integer, long and double evaluation

Throw an error unless the flag is a number of that type. A long or a fractional value is not truncated to an integer; a whole number is a valid long and a valid double.

String evaluation

Never fails. A flag of any other type is rendered in its canonical form, which is not always the text that was configured: 3.10 reads back as 3.1, and the whitespace in a JSON value is not preserved.

Object evaluation

Never fails. A flag of any other type is returned as a value of that type.

For named domains, flags are scoped under the domain name:

quarkus.openfeature."experimentation".runtime.experiment-a=true
quarkus.openfeature."experimentation".runtime.experiment-b=false

Build-time configuration provider

The build-time configuration provider reads flag values that are fixed at build time. These values are baked into the application and cannot be changed at runtime, even with environment variables or system properties.

Add the dependency:

<dependency>
    <groupId>io.quarkiverse.openfeature</groupId>
    <artifactId>quarkus-openfeature-buildtime-config</artifactId>
    <version>1.0.0</version>
</dependency>

Define flags in application.properties:

quarkus.openfeature.buildtime.stable-feature=true
quarkus.openfeature.buildtime.api-version=v2

For named domains:

quarkus.openfeature."experimentation".buildtime.locked-flag=false

Using both providers

You can use both providers together. Add both dependencies and configure the provider order:

quarkus.openfeature.provider=runtime-config,buildtime-config

The first provider in the list that has a value for a given flag wins. In this example, runtime flags take precedence over build-time flags.

This can be useful to define build-time defaults that are overridable at runtime:

quarkus.openfeature.provider=runtime-config,buildtime-config

# Build-time default
quarkus.openfeature.buildtime.new-feature=false

# Runtime override (e.g., set via environment variable in production)
quarkus.openfeature.runtime.new-feature=true

Configuration Reference

Runtime configuration provider

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

quarkus.openfeature."domain-name".runtime."flag-name"

Flag values configurable at runtime, keyed by flag name.

Environment variable: QUARKUS_OPENFEATURE_RUNTIME__FLAG_NAME_

Map<String,String>

Build-time configuration provider

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

quarkus.openfeature."domain-name".buildtime."flag-name"

Flag values fixed at build time, keyed by flag name.

Environment variable: QUARKUS_OPENFEATURE_BUILDTIME__FLAG_NAME_

Map<String,String>