mirror of
https://github.com/Paillat-dev/flagger.git
synced 2026-01-01 16:56:22 +00:00
🐛 Fix flagwaver path configuration in docker image (#5)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user