You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Background
A new `octo-docs-backend` module service is being introduced (not live
yet). Clients need a signal to decide whether to surface the docs module
entry. The client reads `/v1/common/appconfig`; without a dedicated
field it can only fall back to a hardcoded default. This PR exposes that
signal from appconfig.
## Changes
Adds a `docs_on` boolean to `GET /v1/common/appconfig`, mirroring the
existing `sticker_custom_enabled` toggle pattern exactly:
| File | Change |
|---|---|
| `modules/common/system_settings.go` | New getter `DocsEnabled()`
backed by `system_setting docs.enabled`, default `false` |
| `modules/common/system_setting_schema.go` | Register `docs.enabled`
(bool) so it is admin-tunable and converges across replicas via the
settings snapshot |
| `modules/common/api.go` | Add `DocsOn bool json:"docs_on"` to
`appConfigResp`; emitted in **both** return branches (including the
version short-circuit) |
| `modules/common/api_test.go` | Integration tests: default false / DB
true / version short-circuit |
| `modules/common/system_settings_test.go` | Getter unit tests: default
false / DB true |
## Design notes
- **Default `false`**: `octo-docs-backend` is not live, so the entry
stays hidden. Ops flips `docs.enabled` to `1` from the admin console for
a controlled rollout — no redeploy/restart required.
- **Decoupled from `app_config.version`**: the version short-circuit
branch also emits `docs_on`, otherwise clients that hit the
cached-version path would never receive the latest value. Same invariant
already applied to `LocalLoginOff` / `SearchEnabled` /
`StickerCustomEnabled`.
- **Presentation toggle only**: it gates client-side display of the docs
entry and carries no server-side authorization.
## Client adaptation
- Parse as a bool (not `0/1`); default to `false` (hidden) when the
field is absent.
- Always take the latest value from appconfig, even when a local version
cache is hit.
## Testing
Go toolchain not available locally; verified via a `golang:1.25`
container against the local module cache:
- `go build ./modules/common/...`
- `go vet ./modules/common/...`
- `go test -c` (test binary compiles)
Integration tests require MySQL/Redis/WuKongIM and were not run locally
— left to CI.
## Test plan
- [ ] CI Build / Test green
- [ ] `docs_on=false` when `docs.enabled` is unset
- [ ] `docs_on=true` after setting `docs.enabled=1` (including requests
carrying `version`)
Co-authored-by: an9xyz <an9xyz@users.noreply.github.com>
0 commit comments