Keep dev and prod apart
Environments and projects: what is separate in each, how to keep development traffic out of production, and how to promote definitions with lucida pull, plan and apply.
Lucida gives you two levels of separation. Pick the one that matches how much you want to share.
Environments (inside one project)
Every project is created with two environments: production (the default) and development. List them with GET /v1/projects/{project_id}/environments.
Keys are bound to an environment. Mint a key with
{"environment": "development"}(POST {p}/keys). Flag evaluation andflag-definitionsanswer for the key's environment, so a development key sees development flag state and a production key sees production state.Flag state is per environment. A flag's enabled state and filters are stored per environment, so you can turn a flag on in
developmentand leaveproductionuntouched. A kill switch turns it off in every environment.Events carry the environment of the key that sent them through ingest.
Definitions are shared. Flags, cohorts, metrics and dashboards belong to the project; there is one definition with per-environment flag state, not one copy per environment.
Use environments when dev and prod should share one set of definitions and you mostly want to keep test traffic from polluting numbers: use the development key in local and staging builds, and the production key only in production.
Separate projects (full isolation)
Use one project per stage (myapp-dev, myapp-prod) when you want separate data, people, retention and access, or definitions that can drift on purpose. Nothing is shared between projects; each has its own keys.
Promote definitions with the CLI
lucida pull, plan and apply move definitions between projects. Objects match by key or name, never by id, so the same files apply to any project. See Project setup as code for the file layout and what each kind does.
# 1. write the dev project's definitions as files, and review them in git
lucida pull --project <dev project id> --dir lucida
# 2. preview what prod would change; this changes nothing
lucida plan --project <prod project id> --dir lucida
# 3. converge prod
lucida apply --project <prod project id> --dir lucidaNotes:
planprints one line per change and never prints values. A field missing from a file is left alone, not cleared.Keys are create-only and secrets are never pulled. Apply on the target project creates its own keys and shows each secret once.
Run
planin CI on pull requests andapplyon merge to your main branch, with a key scoped to the target project only.Read the
planoutput for flags before you apply: a field that differs, such asenabled, is updated on the target.