diff --git a/cookieplone/filters/__init__.py b/cookieplone/filters/__init__.py index 5ba5093..a5f6454 100644 --- a/cookieplone/filters/__init__.py +++ b/cookieplone/filters/__init__.py @@ -106,3 +106,9 @@ def locales_language_code(code: str) -> str: def image_prefix(registry: str) -> str: """Return the a prefix to be used with all Docker images.""" return containers.image_prefix(registry) + + +@simple_filter +def image_separator(registry: str) -> str: + """ return the separator to be used for Docker images""" + return containers.image_separator(registry) diff --git a/cookieplone/utils/containers.py b/cookieplone/utils/containers.py index 4168deb..fac5e15 100644 --- a/cookieplone/utils/containers.py +++ b/cookieplone/utils/containers.py @@ -2,8 +2,13 @@ # # SPDX-License-Identifier: MIT REGISTRIES = {"docker_hub": "", "github": "ghcr.io/", "gitlab": "registry.gitlab.com/"} +SEPARATORS = {"docker_hub": "-", "github": "-", "gitlab": "/"} def image_prefix(registry: str) -> str: """Return the image prefix to be used based on the registry used.""" return REGISTRIES.get(registry, "") + +def image_separator(registry: str) -> str: + """ Return the image separator to be used based on the registry used. """ + return SEPARATORS.get(registry, "-")