From 7840399d012b913161d80a13130d81e5f908055d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Fri, 5 Dec 2025 14:16:11 +0300 Subject: [PATCH] untrack pyrom_config.toml, provide example with default values instead --- .gitignore | 1 + app/__init__.py | 11 ++++++++++- .../{pyrom_config.toml => pyrom_config.toml.example} | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) rename config/{pyrom_config.toml => pyrom_config.toml.example} (97%) diff --git a/.gitignore b/.gitignore index a5221e4..a80f74c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ data/static/avatars/* !data/static/avatars/default.webp config/secrets.prod.env +config/pyrom_config.toml .local/ diff --git a/app/__init__.py b/app/__init__.py index 1fc6341..4053f40 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -101,7 +101,16 @@ def reparse_babycode(): def create_app(): app = Flask(__name__) - app.config.from_file('../config/pyrom_config.toml', load=tomllib.load, text=False) + try: + app.config.from_file('../config/pyrom_config.toml', load=tomllib.load, text=False) + except FileNotFoundError: + print('No configuration file found, loading defaults.') + app.config['SITE_NAME'] = 'Pyrom' + app.config['DISABLE_SIGNUP'] = False + app.config['MODS_CAN_INVITE'] = True + app.config['USERS_CAN_INVITE'] = False + app.config['ADMIN_CONTACT_INFO'] = '' + app.config['GUIDE_DESCRIPTION'] = '' if os.getenv("PYROM_PROD") is None: app.static_folder = os.path.join(os.path.dirname(__file__), "../data/static") diff --git a/config/pyrom_config.toml b/config/pyrom_config.toml.example similarity index 97% rename from config/pyrom_config.toml rename to config/pyrom_config.toml.example index fc3bfed..c9b1381 100644 --- a/config/pyrom_config.toml +++ b/config/pyrom_config.toml.example @@ -1,4 +1,4 @@ -SITE_NAME = "Porom" +SITE_NAME = "Pyrom" DISABLE_SIGNUP = false # if true, no one can sign up. # if neither of the following two options is true,