mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-28 12:34:01 +03:00
28 lines
684 B
Python
28 lines
684 B
Python
# ruff: noqa
|
|
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)
|