Skip to main content

Quickstart

OPToggles should be run as a docker container.

Port 8080 is used for listening to both OPAL trigger callbacks and http health checks. A configuration yaml file could be supplied through a volume mount, for example:

docker run -n optoggles -p 8080:8080 -v $PWD/config.yaml:/optoggles/config.yaml --rm -it permitio/optoggles:latest

Where config.yaml:

sources:
- id: myopal
url: http://opalclient:7000
advertisedAddress: optoggles:8080

target:
targetType: launchdarkly
targetSpec:
# Replace with your LaunchDarkly API token
launchdarklyToken: "api-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

toggles:
- key: "somefeature"
usersPolicy:
source: myopal
package: "app.rules"
rule: "somefeature_users"
spec:
name: "Some Feature Toggle"
projKey: "default"
environments: [ "production", "staging" ]
  • Optoggles would register to receive callbacks on policy/data changes from OPAL Client instance running at opalclient:7000.
  • Then, query OPAL's corresponding OPA instance for the new value of somefeature_users on every change (somefeature_users is a set of all usernames allowed for some feature).
  • Next, OPToggle will create the toggle if it doesn't already exists
  • Lastly, OPToggle would sync the toggle somefeature in your LaunchDarkly account to target the current set of usernames allowed by the policy.
  • Health checks are available under http://optoggles:8080/health[/live,/started] (More details)

Building your own version of OPToggles is as simple as:

docker build . -t optoggles:$IMAGE_TAG