Fix EOSdash startup (docker)

* Docker: Copy the same directory structure (src/) to support the
   lifespan startup of EOSdash.
   Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide
   EOSdash with session key.
This commit is contained in:
Dominique Lasserre 2025-01-19 13:00:53 +01:00
parent 95be7b914f
commit 437d38f508
4 changed files with 9 additions and 9 deletions

View File

@ -1,8 +1,8 @@
.git/
.github/
eos-data/
mariadb-data/
test_data/
**/__pycache__/
**/*.pyc
**/*.egg-info/
.dockerignore
.env
.gitignore
@ -12,4 +12,4 @@ LICENSE
Makefile
NOTICE
README.md
.venv
.venv/

View File

@ -3,8 +3,6 @@ FROM python:${PYTHON_VERSION}-slim
LABEL source="https://github.com/Akkudoktor-EOS/EOS"
ENV VIRTUAL_ENV="/opt/venv"
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
ENV MPLCONFIGDIR="/tmp/mplconfigdir"
ENV EOS_DIR="/opt/eos"
ENV EOS_CACHE_DIR="${EOS_DIR}/cache"

View File

@ -15,6 +15,7 @@ services:
- .env
environment:
- EOS_CONFIG_DIR=config
- EOS_SERVER__EOSDASH_SESSKEY=s3cr3t
- EOS_PREDICTION__LATITUDE=52.2
- EOS_PREDICTION__LONGITUDE=13.4
- EOS_ELECPRICE__PROVIDER=ElecPriceAkkudoktor

View File

@ -5,7 +5,7 @@ from functools import reduce
from typing import Any, Union
import uvicorn
from fasthtml.common import H1, FastHTML, Table, Td, Th, Thead, Titled, Tr
from fasthtml.common import H1, Table, Td, Th, Thead, Titled, Tr, fast_app
from pydantic.fields import ComputedFieldInfo, FieldInfo
from pydantic_core import PydanticUndefined
@ -94,8 +94,9 @@ for field_name, field_info in list(config_eos.model_fields.items()) + list(
extract_nested_models(field_info, [field_name])
app = FastHTML()
rt = app.route
app, rt = fast_app(
secret_key=os.getenv("EOS_SERVER__EOSDASH_SESSKEY"),
)
def config_table() -> Table: