use unique names for copied env files, use DIR.ENV_FILES

This commit is contained in:
Daniel 2023-12-05 23:32:07 +01:00
parent a6c7a18e7b
commit d196d2a1e4

View file

@ -94,7 +94,7 @@ class EnvManager:
def copy_env_files(self, DIR: DirManager) -> None:
"""Copies all env files to STATES/env_files. Files will be renamed to their own TYPE value."""
env_files_dir = DIR.STATES / "env_files"
env_files_dir.mkdir(exist_ok=True)
for env_file in self.env_files:
shutil.copy(env_file.env_path, env_files_dir / env_file.env_type)
for index, env_file in enumerate(self.env_files):
# will create something like 00-authentik-login.test.dev.local-it.cloud.env
file_name = "-".join([str(index).zfill(2), env_file.env_type, env_file.env_path.name])
shutil.copy(env_file.env_path, DIR.ENV_FILES / file_name)