add config FORCE_SERVER_NAME

This commit is contained in:
Yusur 2025-11-16 09:44:04 +01:00
parent 2f2cd5c04a
commit fb730baa73
2 changed files with 6 additions and 2 deletions

View file

@ -6,6 +6,7 @@
- **BREAKING**: `SERVER_NAME` env variable now contains the domain name. `DOMAIN_NAME` has been removed. - **BREAKING**: `SERVER_NAME` env variable now contains the domain name. `DOMAIN_NAME` has been removed.
- libsuou bumped to 0.6.0 - libsuou bumped to 0.6.0
- Added several REST routes. Change needed due to pending frontend separation. - Added several REST routes. Change needed due to pending frontend separation.
- Deprecated the old web routes except for `/report` and `/admin`
## 0.4.0 ## 0.4.0

View file

@ -26,7 +26,7 @@ from suou import twocolon_list, WantsContentType
from .colors import color_themes, theme_classes from .colors import color_themes, theme_classes
__version__ = '0.5.0-dev43' __version__ = '0.5.0-dev44'
APP_BASE_DIR = os.path.dirname(os.path.dirname(__file__)) APP_BASE_DIR = os.path.dirname(os.path.dirname(__file__))
@ -38,6 +38,7 @@ class AppConfig(ConfigOptions):
database_url = ConfigValue(required=True) database_url = ConfigValue(required=True)
app_name = ConfigValue() app_name = ConfigValue()
server_name = ConfigValue() server_name = ConfigValue()
force_server_name = ConfigValue(cast=bool, default=True)
private_assets = ConfigValue(cast=ssv_list) private_assets = ConfigValue(cast=ssv_list)
# deprecated # deprecated
jquery_url = ConfigValue(default='https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js') jquery_url = ConfigValue(default='https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js')
@ -56,6 +57,8 @@ app.secret_key = app_config.secret_key
app.config['SQLALCHEMY_DATABASE_URI'] = app_config.database_url app.config['SQLALCHEMY_DATABASE_URI'] = app_config.database_url
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False
app.config['QUART_AUTH_DURATION'] = 365 * 24 * 60 * 60 app.config['QUART_AUTH_DURATION'] = 365 * 24 * 60 * 60
if app_config.server_name and app_config.force_server_name:
app.config['SERVER_NAME'] = app_config.server_name app.config['SERVER_NAME'] = app_config.server_name