Skip to main content

⚡️ Configuration File

Configuration File structure

OPToggles expects its configuration file in /etc/optoggles/config.yaml.

The basic structure of the yaml configuration file is:

bind: ":8080"

sources:
- ...
- ...

target:
...

toggles:
- ...
- ...
PathTypeDescription
bindstringBind address for OpToggles' HTTP server. This server is use for getting update triggers from OPAL and for serving health checks.

Sources

The sources section is a list of policy sources. Currently only an OPAL administrated OPA is supported as a policy source.

Each source includes the following attributes

PathTypeDescription
idstringTo be referenced from the toggles section
urlstringThe url base of Opal Client. Used to retrieve OPA's connection details and to register the trigger callback
tokenstringAuthorization token for Opal Client
advertisedAddressstringAddress where this instance of OPToggles is reachable to Opal Client (for callback registration).

Target

The target section tells OPToggles where it should create and sync its user-authorized toggles to. Supported targets:

Only one target is configured for an instance of OPToggles

PathTypeDescription
targetTypestringEither "launchdarkly" or "restapi"
targetSpec.launchdarklyTokenstringRequired if targetType is "launchdarkly".
API access token associated with your LaunchDarkly account. Should have at least Writer privileges.
targetSpec.endpointUrlstringRequired if targetType is "restapi".
The RestAPI endpoint used to create (/POST) and update (/PATCH) toggles
targetSpec.extraHeadersmapOptional if targetType is "restapi".
Extra headers to include in the REST API requests (e.g. Authorization)

Toggles

The toggles section is a list of feature toggles to be managed and continuously updated with the set of allowed users (queried from a specific rule in one of the policy sources).

Each toggle includes the following attributes

PathTypeDescription
keystringUnique identifier for the feature toggle.
usersPolicy.sourcestringThe id of the policy source to use
usersPolicy.packagestringThe OPA package where the desired policy is located
usersPolicy.rulestringThe desired policy's rule name. This rule should return a set of user names for which the feature toggle will be enabled
specmapIf targetType is "restapi", spec could contain any user-defined values to be patched to the REST server as part of the toggle object (e.g. Name, Description, etc...)
spec.namestringRequired if targetType is "launchdarkly".
User readable name for the feature toggle.
spec.projKeystringRequired if targetType is "launchdarkly".
Key of the LaunchDarkly project under which this toggle should be managed.
spec.environmentslistRequired if targetType is "launchdarkly".
The environments in which the feature would be enabled for the queried set of users. The feature would be disabled for other environments.