Skip to content

Commit 561145b

Browse files
committed
feat(emoji.py): add support for Docker-specific emoji assets path
Introduce a new constant, DOCKER_EMOJI_ASSETS_PATH, to specify the location of emoji assets when running in a Docker environment. The EmojiManager now checks if the application is running in Docker and automatically uses this path if no custom path is provided. This change ensures that the application can correctly locate emoji assets when deployed in a Docker container, improving deployment flexibility and ease of configuration.
1 parent 80e3a70 commit 561145b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tux/utils/emoji.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# --- Configuration Constants ---
1010

1111
DEFAULT_EMOJI_ASSETS_PATH = Path(__file__).parents[2] / "assets" / "emojis"
12+
DOCKER_EMOJI_ASSETS_PATH = Path("/app/assets/emojis")
1213
DEFAULT_EMOJI_CREATE_DELAY = 1.0
1314
VALID_EMOJI_EXTENSIONS = [".png", ".gif", ".jpg", ".jpeg", ".webp"]
1415
MIN_EMOJI_NAME_LENGTH = 2
@@ -91,6 +92,11 @@ def __init__(
9192
self._init_lock = asyncio.Lock()
9293
self._initialized = False
9394

95+
# If in Docker and no custom path was provided, use the Docker path
96+
if not emojis_path and DOCKER_EMOJI_ASSETS_PATH.exists() and DOCKER_EMOJI_ASSETS_PATH.is_dir():
97+
logger.info(f"Docker environment detected, using emoji path: {DOCKER_EMOJI_ASSETS_PATH}")
98+
self.emojis_path = DOCKER_EMOJI_ASSETS_PATH
99+
94100
# Ensure the emoji path exists and is a directory
95101
if not self.emojis_path.is_dir():
96102
logger.critical(

0 commit comments

Comments
 (0)