1
0
Fork 0

svc: api: Get URLs file path from env var

The `HUDCTRL_URLS_FILE` environment variable can be used to specify the
location to the `urls.json` file.
master
Dustin 2022-08-01 22:14:06 -05:00
parent 6443b64c02
commit 327d902657
1 changed files with 8 additions and 1 deletions

View File

@ -1,9 +1,11 @@
import io
import logging
import os
from pathlib import Path
from typing import Optional
import fastapi
from PIL import Image
import fastapi
from .hud import HUDService, NoMonitorConfig
from .xrandr import MonitorConfig
@ -15,11 +17,16 @@ log = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
HUDCTRL_URLS_FILE = os.environ.get('HUDCTRL_URLS_FILE')
app = fastapi.FastAPI(
docs_url='/api-doc/',
)
svc = HUDService()
if HUDCTRL_URLS_FILE:
svc.urls_file = Path(HUDCTRL_URLS_FILE)
class PNGImageResponse(fastapi.Response):