From 7cedff22d5793193024514c356c3f76959be394e Mon Sep 17 00:00:00 2001 From: "Nikita P. Shupeyko" Date: Tue, 6 Mar 2018 16:19:32 +0300 Subject: [PATCH] Prettify here and there --- .../.envs/.local/.django | 2 ++ .../.envs/.local/.postgres | 2 ++ .../.envs/.production/.caddy | 2 ++ .../.envs/.production/.postgres | 2 ++ .../merge_production_dotenvs_in_dotenv.py | 19 +++++++++---------- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.django b/{{cookiecutter.project_slug}}/.envs/.local/.django index 48a9eef20..630aa890f 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.django +++ b/{{cookiecutter.project_slug}}/.envs/.local/.django @@ -1 +1,3 @@ +# General +# ------------------------------------------------------------------------------ USE_DOCKER=yes diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.postgres b/{{cookiecutter.project_slug}}/.envs/.local/.postgres index b5295478d..b3da9842d 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.postgres +++ b/{{cookiecutter.project_slug}}/.envs/.local/.postgres @@ -1,2 +1,4 @@ +# PostgreSQL +# ------------------------------------------------------------------------------ POSTGRES_USER=!!!SET POSTGRES_USER!!! POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.caddy b/{{cookiecutter.project_slug}}/.envs/.production/.caddy index e17d5489d..83d7fc7af 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.caddy +++ b/{{cookiecutter.project_slug}}/.envs/.production/.caddy @@ -1 +1,3 @@ +# Caddy +# ------------------------------------------------------------------------------ DOMAIN_NAME={{ cookiecutter.domain_name }} diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.postgres b/{{cookiecutter.project_slug}}/.envs/.production/.postgres index b5295478d..b3da9842d 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.postgres +++ b/{{cookiecutter.project_slug}}/.envs/.production/.postgres @@ -1,2 +1,4 @@ +# PostgreSQL +# ------------------------------------------------------------------------------ POSTGRES_USER=!!!SET POSTGRES_USER!!! POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!! diff --git a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py index 148e1ec23..c1bfe30a3 100644 --- a/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py +++ b/{{cookiecutter.project_slug}}/merge_production_dotenvs_in_dotenv.py @@ -3,15 +3,14 @@ from typing import Sequence import pytest -PROJECT_DIR_PATH = os.path.dirname(os.path.realpath(__file__)) - -PRODUCTION_DOTENV_DIR_PATH = os.path.join(PROJECT_DIR_PATH, '.envs', '.production') +ROOT_DIR_PATH = os.path.dirname(os.path.realpath(__file__)) +PRODUCTION_DOTENVS_DIR_PATH = os.path.join(ROOT_DIR_PATH, '.envs', '.production') PRODUCTION_DOTENV_FILE_PATHS = [ - os.path.join(PRODUCTION_DOTENV_DIR_PATH, '.django'), - os.path.join(PRODUCTION_DOTENV_DIR_PATH, '.postgres'), - os.path.join(PRODUCTION_DOTENV_DIR_PATH, '.caddy'), + os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.django'), + os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.postgres'), + os.path.join(PRODUCTION_DOTENVS_DIR_PATH, '.caddy'), ] -DOTENV_FILE_PATH = os.path.join(PROJECT_DIR_PATH, '.env') +DOTENV_FILE_PATH = os.path.join(ROOT_DIR_PATH, '.env') def merge(output_file_path: str, @@ -32,9 +31,9 @@ def main(): @pytest.mark.parametrize('merged_file_count', range(3)) @pytest.mark.parametrize('append_linesep', [True, False]) -def test_when_merging_given_valid_arguments_should_succeed(tmpdir_factory, - merged_file_count, - append_linesep): +def test_merge(tmpdir_factory, + merged_file_count: int, + append_linesep: bool): tmp_dir_path = str(tmpdir_factory.getbasetemp()) output_file_path = os.path.join(tmp_dir_path, '.env')