Skip to content

[Codex] fix(config): preserve legacy OPENTWS envs and DB path to avoid rebrand-first-boot#554

Open
Micsi wants to merge 4 commits into
abeggled:mainfrom
Micsi:codex/fix-vulnerability-creating-default-admin-account
Open

[Codex] fix(config): preserve legacy OPENTWS envs and DB path to avoid rebrand-first-boot#554
Micsi wants to merge 4 commits into
abeggled:mainfrom
Micsi:codex/fix-vulnerability-creating-default-admin-account

Conversation

@Micsi
Copy link
Copy Markdown
Collaborator

@Micsi Micsi commented May 26, 2026

Motivation

  • Rebranding renamed env prefixes and the default DB/volume which caused upgraded deployments to mount a new empty DB and trigger creation of the default admin/admin account; this change restores compatibility so upgrades reuse existing data and secrets.

Description

  • Added an env bridging helper that maps OPENTWS_*OBS_* only when the corresponding OBS_* key is not already set to preserve operator overrides (obs/config.py).
  • Added a DB-path fallback so the default resolves to /data/opentws.db when /data/obs.db does not exist but the legacy file does, and applied that value as the DatabaseSettings.path default (obs/config.py).
  • Added OPENTWS_CONFIG fallback for _CONFIG_PATH so legacy config file env var is honored when OBS_CONFIG is unset (obs/config.py).

Testing

  • Ran python -m compileall obs/config.py and it completed successfully.
  • Executed a small runtime check that creates a temporary opentws.db, imports the module, and verified _resolve_default_db_path() returns the legacy DB path when only opentws.db exists, which succeeded.

Codex Task

@Micsi
Copy link
Copy Markdown
Collaborator Author

Micsi commented May 26, 2026

Sync-Update aus dem Fork ist eingespielt.

Quelle: Micsi#50

Synchronisierte Änderungen:

  • origin/main in den Head-Branch gemergt (Merge-Konflikt in obs/config.py aufgelöst).
  • Review-Fixes in obs/config.py umgesetzt:
    • DB-Pfad-Fallback jetzt über Settings.database-Default-Factory (kein model_fields-Mutation-Hack mehr).
    • Legacy-Import OPENTWS_* respektiert vorhandene OBS_* Overrides jetzt case-insensitive.
    • OPENTWS_CONFIG Fallback bleibt aktiv.
  • Eintrag in RELEASENOTES.md unter 2026.6.0 / Fixes ergänzt.

Review/Assignment:

  • Assigned: @Micsi
  • Reviewer angefragt: @abeggled

Enthaltener Commit-Stand (zusätzlich zum ursprünglichen PR-Commit):

  • f76dd4a (Merge origin/main)
  • 4156781 (Review-Fixes in obs/config.py)

Lokale Gates im Worktree wurden ausgeführt:

  • ./tools/lint.sh --check
  • ./scripts/check-i18n-hardcoded-strings.sh
  • Pre-push Hook lief inkl. kompletter Pytest-Suite grün (1536 passed, 7 skipped).

@Micsi
Copy link
Copy Markdown
Collaborator Author

Micsi commented May 26, 2026

Sync-Update: offene Review-Punkte aus dem Fork wurden adressiert.

Quelle: Micsi#50

Neu synchronisiert:

  • obs/config.py: _config_path() liest OBS_CONFIG jetzt case-insensitive (inkl. obs_config) und priorisiert korrekt vor OPENTWS_CONFIG.
  • obs/config.py: DB-Fallback auf opentws.db bleibt auch bei partiellen database.* Overrides aktiv (z. B. nur history_plugin).
  • RELEASENOTES.md: Fix-Eintrag für genau diese beiden Punkte präzisiert.

Commit-Stand jetzt im Upstream-PR enthalten:

  • 2de0404 (case-insensitive config precedence + partial database override fallback)

Lokale Gates im Worktree:

  • ./tools/lint.sh --check
  • ./scripts/check-i18n-hardcoded-strings.sh
  • Pre-push Hook inkl. kompletter Pytest-Suite ✅ (1536 passed, 7 skipped).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Security Security-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant