persist public url in settings#25
Merged
Merged
Conversation
- Added SettingsRepository for CRUD operations on settings. - Initialized settings from configuration on application startup.
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.
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
settingstable, 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:
settingstable with fields forid,public_url, andupdated_at(e18675e6eecb_add_settings_table.py).SettingsSQLModel entity and aSettingsRepositoryfor CRUD operations on the singleton settings row. [1] [2]Settings Handling Logic:
SettingsHandlerto useSettingsRepositoryfor all reads/writes of the public URL, making the database the source of truth. Added aninitialize_from_configmethod to sync environment/config values to the database on startup. [1] [2] [3] [4]Application Initialization:
main.pyto instantiate and register the newSettingsRepositoryandSettingsHandler, and to callinitialize_from_configat 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:
__all__exports to include the newSettingsentity andSettingsRepositoryin 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.