Skip to content

Commit

Permalink
Add option to set prefix for compose project and container names
Browse files Browse the repository at this point in the history
  • Loading branch information
mdebic committed Nov 18, 2024
1 parent bfcbbb8 commit 88b0c0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 9 additions & 2 deletions adit_radis_shared/invoke_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ def get_project_dir():
assert PROJECT_DIR is not None
return PROJECT_DIR

@staticmethod
def get_compose_project_name():
config = Utility.load_config_from_env_file()
if config.get("COMPOSE_PROJECT_NAME") is not None:
return
return Utility.get_project_name()

@staticmethod
def load_config_from_env_file() -> dict[str, str | None]:
env_file = Utility.get_project_dir() / ".env"
Expand Down Expand Up @@ -87,8 +94,8 @@ def get_compose_env_file():
@staticmethod
def get_stack_name():
if Utility.is_production():
return f"{Utility.get_project_name()}_prod"
return f"{Utility.get_project_name()}_dev"
return f"{Utility.get_compose_project_name()}_prod"
return f"{Utility.get_compose_project_name()}_dev"

@staticmethod
def build_compose_cmd(profiles: list[str] = []):
Expand Down
3 changes: 3 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ SSL_CHAIN_FILE="./chain.pem"

# The timezone that the web interface uses.
USER_TIME_ZONE="Europe/Berlin"

# Optional prefix for compose project and docker container, defaults to adit
# COMPOSE_PROJECT_NAME="your_project_name"

0 comments on commit 88b0c0b

Please sign in to comment.