Skip to content

feat(selfhost): boot-time preflight that reports missing/invalid required env with actionable messages #2080

Description

@JSONbored

Required-env failures currently throw raw one-line errors scattered through server.ts (REDIS_URL at :422, PUBLIC_API_ORIGIN at :604, SELFHOST_SETUP_TOKEN at :595). There is no single preflight that validates the whole required set at once, so operators fix one var, restart, hit the next. Add a pure preflightEnv(env): {ok, problems[]} that checks the required/conditionally-required vars (REDIS_URL always; PUBLIC_API_ORIGIN+SELFHOST_SETUP_TOKEN when no GITHUB_APP_ID; DATABASE_URL well-formed when set) and returns every problem with a one-line fix hint.

Deliverables

  • Add preflightEnv in a new src/selfhost/preflight.ts returning {ok:boolean, problems:{var:string, message:string}[]}
  • Cover: REDIS_URL required; setup-wizard vars required only when GITHUB_APP_ID unset; DATABASE_URL must start with postgres:// when present
  • Return ALL problems, not just the first
  • Never print secret VALUES — only names and hints
  • Unit tests for each rule incl. the conditional-required branches (GITHUB_APP_ID set vs unset) and the DATABASE_URL scheme check

References

  • src/server.ts:422
  • src/server.ts:595
  • src/server.ts:604
  • src/selfhost/ai-config.ts:31

size: M · gittensor:feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions