Opt-in switch for the service configuration API and frontend - #972
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opt-in switch for the service configuration API and UI
Adds
service.serviceConfigEnabled— a per-deployment switch that decides whether the service configuration is manageable from osctrl-api and the SPA. It does not change how configuration is loaded.Loading model (unchanged, and unaffected by the switch)
YAML remains the source of truth on disk. Every boot, both services:
service_configtable (create-if-missing),Services therefore always run on the DB rows. That means the rows can be edited directly — from a hypervisor/infra perspective, or any DB client — and are picked up on the next restart, with no YAML edit needed.
What the switch changes
serviceConfigEnabled: false(default)serviceConfigEnabled: trueservice_configseeding/api/v1/service-config/*routesGET /api/v1/featuresservice_config: falseservice_config: trueDeep-linking to
/config/apiwith the feature off renders an empty state explaining that values live in theservice_configtable and how to turn the API on — and issues no requests to the missing endpoints.Consumed by osctrl-api only. The key is present in
tls.ymlso theservicesection still round-trips through the API unchanged; osctrl-tls seeds and resolves either way.Configuration
Also settable as
--service-config-enabledorSERVICE_CONFIG_ENABLED=true. Enabled indocker-compose-dev.ymlfor both services so local dev keeps the UI.Changes
pkg/config/types.go,pkg/config/flags.go— newService.ServiceConfigEnabledfield, CLI flag and env var (defaultfalse).cmd/api/main.go— seeding/resolving/file-status reporting stay unconditional; the whole/api/v1/service-configroute block (reads, section update, apply, persist, and its rate limiter) is registered only when enabled. Logs a line at boot when off.cmd/api/handlers/{handlers,features}.go—WithServiceConfigEnabledoption;/api/v1/featuresadvertisesservice_config.frontend/—Features.service_config; SideNav hides the entry;ServiceConfigPageshows the disabled state and skips its queries and the impact-warning modal when off.deploy/config/{api,tls}.yml— annotated sample values.Testing
go build ./...,go test ./...— pass. New: flag defaults-off test, features-response test.tscclean. New: disabled-state test asserting the page requests nothing.