From 719c6da65cec24904aaffd16321b410415a346d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20B=C3=B6hm?= Date: Fri, 20 Aug 2021 16:53:13 +0200 Subject: [PATCH] Use dev and prod configs instead of debug for hocon option --- hooks/post_gen_project.py | 7 ++++--- tests/test_options.py | 4 ++-- .../config/{debug.conf => dev.conf} | 1 + {{cookiecutter.project_slug}}/config/prod.conf | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) rename {{cookiecutter.project_slug}}/config/{debug.conf => dev.conf} (52%) create mode 100644 {{cookiecutter.project_slug}}/config/prod.conf diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 4c14940..e80176c 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -64,14 +64,15 @@ files_config_hocon = [ f'{module_dir}/util__hocon.py', f'{module_dir}/res/default.conf', - 'config/debug.conf', + 'config/dev.conf', + 'config/prod.conf', ] files_ci_gitlab = { ".gitlab-ci.yml", } -files_ci_all = files_ci_gitlab +files_ci_all = files_ci_gitlab folders_editor = [ '.idea__editor', @@ -165,7 +166,7 @@ def handle_editor_settings(): def handle_ci(): ci_pipeline = '{{ cookiecutter.ci_pipeline }}' - if ci_pipeline == "gitlab": + if ci_pipeline == "gitlab": _delete_files(files_ci_all - files_ci_gitlab) elif ci_pipeline == 'none': _delete_files(files_ci_all) diff --git a/tests/test_options.py b/tests/test_options.py index 83ed6cf..6783bc5 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -83,7 +83,7 @@ def test_config_hocon(): check_project( settings={'config_file': 'hocon', 'create_cli': 'yes'}, files_existent=['src/{module_name}/util.py', 'src/{module_name}/res/default.conf', - 'config/debug.conf'], + 'config/dev.conf', 'config/prod.conf'], files_non_existent=['config/config.yml'], test_cli=True, run_pytest=True) @@ -92,7 +92,7 @@ def test_config_yaml(): check_project( settings={'config_file': 'yaml'}, files_existent=['src/{module_name}/util.py', 'config/config.yml'], - files_non_existent=['config/debug.conf', 'src/{module_name}/res/default.conf'], + files_non_existent=['config/dev.conf', 'config/prod.conf', 'src/{module_name}/res/default.conf'], run_pytest=True) diff --git a/{{cookiecutter.project_slug}}/config/debug.conf b/{{cookiecutter.project_slug}}/config/dev.conf similarity index 52% rename from {{cookiecutter.project_slug}}/config/debug.conf rename to {{cookiecutter.project_slug}}/config/dev.conf index 5d668c9..e99d3eb 100644 --- a/{{cookiecutter.project_slug}}/config/debug.conf +++ b/{{cookiecutter.project_slug}}/config/dev.conf @@ -1 +1,2 @@ +environment = "dev" logging.level = DEBUG diff --git a/{{cookiecutter.project_slug}}/config/prod.conf b/{{cookiecutter.project_slug}}/config/prod.conf new file mode 100644 index 0000000..23a817b --- /dev/null +++ b/{{cookiecutter.project_slug}}/config/prod.conf @@ -0,0 +1 @@ +environment = "prod"