Repository navigation
feat: live settings: signup, signup quota, retention and terms changeable from the operator console - #16
Merged
Conversation
Step 1 of live settings (spec A5), data side only: no route, no runtime wiring. - New pure module settings: the env parsers (parse_quota, parse_fetch_cap, parse_retention, parse_terms, is_terms_url, py_strip) moved out of main.rs unchanged; Live with a source per value (db | env | env-locked | default); build_live (startup env, destinations policy, override rows -> Live plus stderr notes); validate_put (400 / 409 / reason rules). - Table settings(key, value, updated_at); store::settings_rows reads only the four live keys; store::operator_update_settings writes a change and one settings.update audit row in one transaction. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX
…rtup overrides AppState holds the effective live values as an Arc<Live> behind a lock held only to clone or swap it; each request takes one snapshot. Only the signup handler, GET /health, the operator org create and retention_pass read it. Config.signup_open keeps its startup meaning, so fetch_cap(), the destinations default and the hosted checks are untouched. With the operator token unset the settings table is never read. AppState::apply_settings writes a change, re-reads the rows, rebuilds Live and swaps it inside one db.with. main.rs fills Config.env_flags and judges the open-signup warnings on the effective values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX
GET shows the four live settings with their source and the env-only values (no secret). PUT validates with the env parsers' rules, writes the rows and one settings.update audit row, and swaps the live values in the same critical section. Overview features gain "settings". Unsetting a retention override that falls back to a lower value needs a reason like a lowering set does. Docs: operator.md "Live settings", server.md, README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX
…RLs, the brake fails closed, ignored rows are shown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX
Merged
LukiPrince
added a commit
that referenced
this pull request
Nov 14, 2026
Support access (#15) and live settings (#16). The example version in docs/operator.md follows. Claude-Session: https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Live settings, PR 3 of the operator API: the console can change four settings while the server runs, without a restart. Without
PRINTAPI_OPERATOR_TOKENnothing changes: the newsettingstable is never read, every value is the environment one as in 3.5.0, and/operator/settingsis 404.What is live (
docs/operator.md#live-settings)signup,signup_quota,job_retention_daysandterms. The environment variables are the start values. With the token set, a database override applies on top of them.GET /operator/settingsreturns each key's value and source (db|env|env-locked|default). A key also getsignoredwhen its stored row is not applied.env_onlyshows the startup-only values and never holds a secret.PUT /operator/settings{set, unset, reason?}validates with the env parsers' rules, which moved into the pure modulesettings.rs. It writes in one transaction with onesettings.updateaudit row. The rows are then re-read andLiveis swapped, in the same critical section.GET /health, the operator org create and the retention pass.features: ["support", "settings"].Kept apart from the security defaults
fetch_cap(), the private-URL policy, trusted proxies and the operator gate keep their startup values. Opening or closing signup live moves none of them. Tested: after a live open and close, araw_urito 127.0.0.1 and an event delivery to 10.0.0.1 are still refused.unsetfalling back to an envopen. The same rule applies at startup, where such a DB row is ignored with a stderr line.PRINTAPI_SIGNUPother thanopenlocks signup shut and beats the database. That coversclosed, but alsoCLOSED,offor a typo. While locked, only closing changes are accepted.job_retention_dayschange that lowers retention, or switches it on, needs a reason of at least 8 characters, because the next pass scrubs for good.Fixes from the review (security and Codex adversarial, read-only, each cross-checked)
unsetcould reopen signup with private URLs allowed.CLOSED,off, a typo).Checks
cargo test --workspace1103 passed, clippy-D warnings, fmt.check_docsOK.--db-compat23/23./health.PRINTAPI_SIGNUP=CLOSED, signup is env-locked and the DB row shows asignored.PRINTAPI_PRIVATE_URLS=allow, the open row is ignored.No release (that would be 3.6.0, only after asking).
🤖 Generated with Claude Code
https://claude.ai/code/session_01TEvvb3zrZ3bLSGJbCBaEYX