Skip to content

persist public url in settings#25

Merged
shubham3121 merged 1 commit into
mainfrom
chore/persist-settings
Jan 13, 2026
Merged

persist public url in settings#25
shubham3121 merged 1 commit into
mainfrom
chore/persist-settings

Conversation

@shubham3121

Copy link
Copy Markdown
Member

This pull request introduces a persistent settings system for managing the application's public URL, moving the source of truth from in-memory config to a database-backed singleton table. It adds a new settings table, a corresponding SQLModel entity, a repository for CRUD operations, and updates the handler and initialization logic to use this new persistence layer. The public URL is now consistently managed through the database, with initialization from environment variables if set.

Database & Persistence Layer:

  • Added a new Alembic migration to create a settings table with fields for id, public_url, and updated_at (e18675e6eecb_add_settings_table.py).
  • Introduced the Settings SQLModel entity and a SettingsRepository for CRUD operations on the singleton settings row. [1] [2]

Settings Handling Logic:

  • Refactored SettingsHandler to use SettingsRepository for all reads/writes of the public URL, making the database the source of truth. Added an initialize_from_config method to sync environment/config values to the database on startup. [1] [2] [3] [4]

Application Initialization:

  • Updated main.py to instantiate and register the new SettingsRepository and SettingsHandler, and to call initialize_from_config at startup. The app now updates the database (not just config) when the public URL is set via ngrok or environment variable. [1] [2] [3] [4]

Imports & Module Exports:

  • Updated imports and __all__ exports to include the new Settings entity and SettingsRepository in the settings component.

These changes ensure that the application's public URL is reliably persisted and synchronized across restarts and deployments, supporting future extensibility for other settings.

- Added SettingsRepository for CRUD operations on settings.
- Initialized settings from configuration on application startup.
@shubham3121 shubham3121 merged commit fafa5d4 into main Jan 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant