🐛 Fix flagwaver path configuration in docker image (#5)

This commit is contained in:
2025-12-09 00:17:35 +01:00
committed by GitHub
parent 31c115ed5a
commit fa02d4b3f7
3 changed files with 6 additions and 4 deletions

View File

@@ -43,6 +43,8 @@ RUN pip install $(grep '^playwright==' requirements.txt | tr -d '\\') && playwri
RUN pip install -r requirements.txt
COPY --from=node-base --chown=appuser /app/dist/ ./src/static/flagwaver
ENV FLAGWAVER_PATH=/app/src/static/flagwaver
COPY src/ ./src
USER appuser

View File

@@ -10,7 +10,6 @@ sys.path.append(os.path.dirname(__file__))
import asyncio
import logging
from pathlib import Path
from discord import Intents
from pycord_rest import App
@@ -36,13 +35,11 @@ app = App(
default_command_integration_types={discord.IntegrationType.guild_install, discord.IntegrationType.user_install},
)
FLAGWAVER_PATH = Path(__file__).parent / "flagwaver" / "dist"
async def main() -> None:
async with (
RendererManager(num_workers=CONFIG.num_workers) as manager,
HttpServer(port=CONFIG.flagwaver_http_port, path=FLAGWAVER_PATH),
HttpServer(port=CONFIG.flagwaver_http_port, path=CONFIG.flagwaver_path),
):
renderer = FlagRenderer(manager, f"http://localhost:{CONFIG.flagwaver_http_port}")
app.add_cog(FlaggerCommands(app, manager, renderer))

View File

@@ -2,6 +2,7 @@
# SPDX-License-Identifier: MIT
import os
from pathlib import Path
from pydantic import BaseModel
@@ -20,6 +21,7 @@ class Config(BaseModel):
flagwaver_http_port: int = 8910
uvicorn_host: str = "0.0.0.0" # noqa: S104
auto_sync_commands: bool = True
flagwaver_path: Path
CONFIG = Config(
@@ -29,6 +31,7 @@ CONFIG = Config(
flagwaver_http_port=int(os.getenv("FLAGWAVER_HTTP_PORT", "8910")),
uvicorn_host=os.getenv("UVICORN_HOST", "0.0.0.0"), # noqa: S104
auto_sync_commands=os.getenv("AUTO_SYNC_COMMANDS", "true") == "true",
flagwaver_path=Path(os.getenv("FLAGWAVER_PATH", Path(__file__).parent / "flagwaver" / "dist")),
)
__all__ = ["CONFIG"]