From 5b280c18ba7a75553c16d6d3e9ba34c0cfcc3249 Mon Sep 17 00:00:00 2001 From: Stanislav Khlud Date: Thu, 9 Nov 2023 10:36:00 +0700 Subject: [PATCH] Code review fixes --- saritasa_invocations/alembic.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/saritasa_invocations/alembic.py b/saritasa_invocations/alembic.py index 78b6fe6..d256891 100644 --- a/saritasa_invocations/alembic.py +++ b/saritasa_invocations/alembic.py @@ -194,7 +194,7 @@ def _get_migration_files_paths( def load_db_dump( context: invoke.Context, file: str = "", - env_file_path: str = "", + env_file_path: str = ".env", reset_db: bool = True, ) -> None: """Reset db and load db dump.""" @@ -211,12 +211,13 @@ def load_db_dump( def backup_local_db( context: invoke.Context, file: str = "", + env_file_path: str = ".env", ) -> None: """Back up local db.""" db.backup_local_db( context, file=file, - **_load_local_env_db_settings(context), + **_load_local_env_db_settings(context, file=env_file_path), ) @@ -243,7 +244,7 @@ def load_remote_db( def _load_local_env_db_settings( context: invoke.Context, - file: str = "", + file: str, ) -> dict[str, str]: """Load local db settings from .env file. @@ -256,7 +257,7 @@ def _load_local_env_db_settings( # during project initialization import decouple - secrets = decouple.Config(decouple.RepositoryEnv(file or ".env")) + secrets = decouple.Config(decouple.RepositoryEnv(file)) config = _config.Config.from_context(context) return { arg: str(secrets(env_var))