diff --git a/backoffice/merge_production_dotenvs_in_dotenv.py b/backoffice/merge_production_dotenvs_in_dotenv.py deleted file mode 100644 index 35139fb2..00000000 --- a/backoffice/merge_production_dotenvs_in_dotenv.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -from collections.abc import Sequence -from pathlib import Path - -BASE_DIR = Path(__file__).parent.resolve() -PRODUCTION_DOTENVS_DIR = BASE_DIR / ".envs" / ".production" -PRODUCTION_DOTENV_FILES = [ - PRODUCTION_DOTENVS_DIR / ".django", - PRODUCTION_DOTENVS_DIR / ".postgres", -] -DOTENV_FILE = BASE_DIR / ".env" - - -def merge( - output_file: Path, - files_to_merge: Sequence[Path], -) -> None: - merged_content = "" - for merge_file in files_to_merge: - merged_content += merge_file.read_text() - merged_content += os.linesep - output_file.write_text(merged_content) - - -if __name__ == "__main__": - merge(DOTENV_FILE, PRODUCTION_DOTENV_FILES) diff --git a/backoffice/tests/test_merge_production_dotenvs_in_dotenv.py b/backoffice/tests/test_merge_production_dotenvs_in_dotenv.py deleted file mode 100644 index 45513d60..00000000 --- a/backoffice/tests/test_merge_production_dotenvs_in_dotenv.py +++ /dev/null @@ -1,33 +0,0 @@ -from pathlib import Path - -import pytest -from merge_production_dotenvs_in_dotenv import merge - - -@pytest.mark.parametrize( - ("input_contents", "expected_output"), - [ - ([], ""), - ([""], "\n"), - (["JANE=doe"], "JANE=doe\n"), - (["SEP=true", "AR=ator"], "SEP=true\nAR=ator\n"), - (["A=0", "B=1", "C=2"], "A=0\nB=1\nC=2\n"), - (["X=x\n", "Y=y", "Z=z\n"], "X=x\n\nY=y\nZ=z\n\n"), - ], -) -def test_merge( - tmp_path: Path, - input_contents: list[str], - expected_output: str, -): - output_file = tmp_path / ".env" - - files_to_merge = [] - for num, input_content in enumerate(input_contents, start=1): - merge_file = tmp_path / f".service{num}" - merge_file.write_text(input_content) - files_to_merge.append(merge_file) - - merge(output_file, files_to_merge) - - assert output_file.read_text() == expected_output