diff --git a/.env.example b/.env.example index a43bfcad6..6c9f41c98 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,9 @@ -FLASK_APP=lnbits.app -FLASK_ENV=development +QUART_APP=lnbits.app +QUART_ENV=development +QUART_DEBUG=1 + +HOST=127.0.0.1 +PORT=5000 LNBITS_SITE_TITLE=LNbits LNBITS_ALLOWED_USERS="" diff --git a/Dockerfile b/Dockerfile index 9e53a6195..f959cbd51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.7-slim WORKDIR /app COPY requirements.txt /app/ RUN pip install --no-cache-dir -q -r requirements.txt -RUN pip install --no-cache-dir -q gunicorn gevent +RUN pip install --no-cache-dir -q hypercorn COPY . /app EXPOSE 5000 diff --git a/Procfile b/Procfile index 3d7b459b7..0b1764fcf 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: gunicorn -b :5000 lnbits:app -k gevent +web: hypercorn --bind 0.0.0.0:5000 lnbits:app diff --git a/lnbits/__main__.py b/lnbits/__main__.py index 31a4de110..2fa0c72a3 100644 --- a/lnbits/__main__.py +++ b/lnbits/__main__.py @@ -5,4 +5,4 @@ from .commands import migrate_databases migrate_databases() app = create_app() -app.run() +app.run(host=app.config["HOST"], port=app.config["PORT"]) diff --git a/lnbits/settings.py b/lnbits/settings.py index 905003ee8..b33356a2f 100644 --- a/lnbits/settings.py +++ b/lnbits/settings.py @@ -11,6 +11,11 @@ env.read_env() wallets_module = importlib.import_module("lnbits.wallets") wallet_class = getattr(wallets_module, env.str("LNBITS_BACKEND_WALLET_CLASS", default="VoidWallet")) +ENV = env.str("QUART_ENV", default="production") +DEBUG = env.bool("QUART_DEBUG") or ENV == "development" +HOST = env.str("HOST", default="127.0.0.1") +PORT = env.int("PORT", default=5000) + LNBITS_PATH = path.dirname(path.realpath(__file__)) LNBITS_DATA_FOLDER = env.str("LNBITS_DATA_FOLDER", default=path.join(LNBITS_PATH, "data")) LNBITS_ALLOWED_USERS: List[str] = env.list("LNBITS_ALLOWED_USERS", default=[], subcast=str)