Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cookieplone/filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 5 additions & 0 deletions cookieplone/utils/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, "-")