diff --git a/README.md b/README.md index c30dc91..1d447bf 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Collection of [invoke](https://www.pyinvoke.org/) commands used by Saritasa * [git](#git) * [git.set-git-setting](#gitset-git-setting) * [git.setup](#gitsetup) + * [git.clone-repo](#gitclone-repo) * [pre-commit](#pre-commit) * [pre-commit.install](#pre-commitinstall) * [pre-commit.run-hooks](#pre-commitrun-hooks) @@ -252,6 +253,10 @@ Settings: * `merge_ff` setting value for `merge.ff` (Default: `false`) * `pull_ff` setting value for `pull.ff` (Default: `only`) +#### git.clone-repo + +Clone repo or pull latest changes to specified repo + ### pre-commit #### pre-commit.install @@ -466,7 +471,18 @@ Uses [create_dump](#db-k8screate-dump) and [get-dump](#db-k8sget-dump) Settings: * `settings_path` default django settings (Default: `config.settings.local`) -* `remote_db_config_mapping` Mapping of db config (Default: `{"dbname": "RDS_DB_NAME", "host": "RDS_DB_HOST", "port": "RDS_DB_PORT", "username": "RDS_DB_USER", "password": "RDS_DB_PASSWORD"}`) +* `remote_db_config_mapping` Mapping of db config + Default: + + ```python + { + "dbname": "RDS_DB_NAME", + "host": "RDS_DB_HOST", + "port": "RDS_DB_PORT", + "username": "RDS_DB_USER", + "password": "RDS_DB_PASSWORD", + } + ``` #### django.load-remote-db @@ -556,7 +572,19 @@ Installed with `[env_settings]` Settings: -* `db_config_mapping` Mapping of db config (Default: `{ "dbname": "rds_db_name", "host": "rds_db_host", "port": "rds_db_port", "username": "rds_db_user", "password": "rds_db_password"}`) +* `db_config_mapping` Mapping of db config + + Default: + + ```python + { + "dbname": "rds_db_name", + "host": "rds_db_host", + "port": "rds_db_port", + "username": "rds_db_user", + "password": "rds_db_password", + } + ``` #### alembic.backup-local-db @@ -570,7 +598,19 @@ Installed with `[env_settings]` Settings: -* `db_config_mapping` Mapping of db config (Default: `{ "dbname": "rds_db_name", "host": "rds_db_host", "port": "rds_db_port", "username": "rds_db_user", "password": "rds_db_password"}`) +* `db_config_mapping` Mapping of db config + + Default: + + ```python + { + "dbname": "rds_db_name", + "host": "rds_db_host", + "port": "rds_db_port", + "username": "rds_db_user", + "password": "rds_db_password", + } + ``` #### alembic.backup-remote-db @@ -584,13 +624,25 @@ Installed with `[env_settings]` Settings: -* `db_config_mapping` Mapping of db config (Default: `{ "dbname": "rds_db_name", "host": "rds_db_host", "port": "rds_db_port", "username": "rds_db_user", "password": "rds_db_password"}`) +* `db_config_mapping` Mapping of db config + + Default: + + ```python + { + "dbname": "rds_db_name", + "host": "rds_db_host", + "port": "rds_db_port", + "username": "rds_db_user", + "password": "rds_db_password", + } + ``` #### alembic.load-remote-db Make dump of remote db and download it and apply to local db. -Uses [create_dump](#db-k8screate-dump) and [get-dump](#db-k8sget-dump) and +Uses [create-dump](#db-k8screate-dump) and [get-dump](#db-k8sget-dump) and [load-db-dump](#alembicload-db-dump) Requires [python-decouple](https://github.com/HBNetwork/python-decouple) @@ -599,7 +651,19 @@ Installed with `[env_settings]` Settings: -* `db_config_mapping` Mapping of db config (Default: `{ "dbname": "rds_db_name", "host": "rds_db_host", "port": "rds_db_port", "username": "rds_db_user", "password": "rds_db_password"}`) +* `db_config_mapping` Mapping of db config + + Default: + + ```python + { + "dbname": "rds_db_name", + "host": "rds_db_host", + "port": "rds_db_port", + "username": "rds_db_user", + "password": "rds_db_password", + } + ``` ### celery @@ -832,6 +896,9 @@ Settings: #### secrets.setup-env-credentials Fill specified credentials in your file from k8s. +This invocations downloads `.env` file from pod in k8s. +It will replace specified credentials(`--credentials`) in +specified file `.env` file (`--env_file_path` or `.env` as default) Requires [python-decouple](https://github.com/HBNetwork/python-decouple) diff --git a/saritasa_invocations/secrets.py b/saritasa_invocations/secrets.py index 2a0ade8..508aad5 100644 --- a/saritasa_invocations/secrets.py +++ b/saritasa_invocations/secrets.py @@ -11,7 +11,7 @@ def setup_env_credentials( context: invoke.Context, credentials: collections.abc.Sequence[str], - env_file_path: str = "", + env_file_path: str = ".env", ) -> None: """Fill specified credentials. @@ -29,7 +29,7 @@ def setup_env_credentials( secrets = decouple.Config(decouple.RepositoryEnv(file_path)) cred_params = {cred: str(secrets(cred)) for cred in credentials} env_secret_replacer( - env_file_path=env_file_path or ".env", + env_file_path=env_file_path, **cred_params, )