8000 Settings are read in many places, and a bad value is handled four different ways · Issue #301 · alexbeeken/skrongle-mini · GitHub
[go: up one dir, main page]

Skip to content

Settings are read in many places, and a bad value is handled four different ways #301

Backlog

Description

@alexbeeken

Config exists (src/main.rs:185), but the environment is also read where it is used:

  • src/ai.rs:389, :1230, :1358 (the last one per model request)
  • src/ai/providers.rs:115, src/jobs/retention.rs:34, src/signup.rs:50, src/proxy_auth.rs:147, src/prices.rs:46
  • src/routes/docs.rs:112 reads PUBLIC_URL although state.public_url exists. PUBLIC_URL is read in five places.
  • Config::from_lookup takes a lookup it can be tested with, then calls prices::PriceTable::from_env(), which reads the real environment (src/main.rs:286).

A value that does not parse is:

  • fatal for BIND, SIGNUP, MIN_AGE, AI_PRICES
  • warned about and defaulted for LOG
  • silently defaulted for COURSE_BYTES, COURSE_BYTES_PER_USER, COURSES_PER_USER, RETAIN_HISTORY_DAYS, AI_TIMEOUT_SECS, AI_JOB_BUDGET_SECS
  • silently off for booleans: v == "1" || v == "true" is written 5 times, so SKRONGLE_SECURE_COOKIES=yes is off without a word

The last one is a security setting a self-hoster believes they turned on.

Fix, one PR: parse every setting in Config::from_lookup with one rule (a bad value stops the start and names the variable). Put the AI timeouts, the private-URL flag, retention and the base URLs in AppState. skrongle doctor prints from the same struct.

Also here: signup::MIN_AGE is a OnceLock set from main although signup: Mode is in AppState; and static CALLS: Slots (src/tutor.rs:732) holds the two tutor slots for the whole process while tutor::Sessions is in AppState, so every router test in one binary shares them. Move both into AppState.

From the code review of 24 November 2026. Line numbers are as of 0.5.0 (2547b36).

Activity

  1. added
    review
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0