From 22189b41eadda97f122b0cad1b3fa754a599b469 Mon Sep 17 00:00:00 2001 From: Fillipe Goulart Date: Sat, 8 Nov 2025 17:19:28 -0300 Subject: [PATCH 1/2] Rename variable to `db_name` The previous variable `default_db_name` made no sense as there are no other variables overwriting this. And even if the user wishes to do so, he/she can do it via env variables or another `.toml` file --- settings.toml | 2 +- src/app/app.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/settings.toml b/settings.toml index 1a6e8b3..452f9b3 100644 --- a/settings.toml +++ b/settings.toml @@ -1,4 +1,4 @@ -default_db_name = "kanban.db" +db_name = "kanban.db" task__title_max_length = 50 category__name_max_length = 50 statuses = ["To-do", "In progress", "Review", "Done"] diff --git a/src/app/app.py b/src/app/app.py index 51446f7..5d20260 100644 --- a/src/app/app.py +++ b/src/app/app.py @@ -22,7 +22,7 @@ def create_app() -> Typer: def main( filename: Annotated[ str, Option("-f", "--filename", help="File name") - ] = settings.default_db_name, + ] = settings.db_name, ) -> None: """Simple Kanban management in the command line""" # Local import to prevent circular imports From 4733e735e9a2d28bc490adff1710c896d1e54467 Mon Sep 17 00:00:00 2001 From: Fillipe Goulart Date: Sat, 8 Nov 2025 17:31:03 -0300 Subject: [PATCH 2/2] Allow possibility to overwrite variables The user can overwrite everything by creating a `kb_settings.toml` file instead of just creating environment variables --- config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index e251c29..d1c4bbf 100644 --- a/config.py +++ b/config.py @@ -1,8 +1,11 @@ from dynaconf import Dynaconf +# The user can overwrite existing variables with either: +# - creating environment variables starting with `KB_` such as `KB_DB_NAME`; or +# - create a `kb_settings.toml` and add the variables they want settings = Dynaconf( envvar_prefix="KB", - settings_files=["settings.toml", ".secrets.toml"], + settings_files=["settings.toml", ".secrets.toml", "kb_settings.toml"], ) # `envvar_prefix` = export envvars with `export DYNACONF_FOO=bar`.