mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-04 04:20:47 +02:00
let poetry run lnbits recognize forwarded_ips for https (#1109)
This commit is contained in:
@ -1,9 +1,7 @@
|
|||||||
import time
|
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
from lnbits.settings import HOST, PORT
|
from lnbits.settings import FORWARDED_ALLOW_IPS, HOST, PORT
|
||||||
|
|
||||||
|
|
||||||
@click.command(
|
@click.command(
|
||||||
@ -14,10 +12,20 @@ from lnbits.settings import HOST, PORT
|
|||||||
)
|
)
|
||||||
@click.option("--port", default=PORT, help="Port to listen on")
|
@click.option("--port", default=PORT, help="Port to listen on")
|
||||||
@click.option("--host", default=HOST, help="Host to run LNBits on")
|
@click.option("--host", default=HOST, help="Host to run LNBits on")
|
||||||
|
@click.option(
|
||||||
|
"--forwarded-allow-ips", default=FORWARDED_ALLOW_IPS, help="Allowed proxy servers"
|
||||||
|
)
|
||||||
@click.option("--ssl-keyfile", default=None, help="Path to SSL keyfile")
|
@click.option("--ssl-keyfile", default=None, help="Path to SSL keyfile")
|
||||||
@click.option("--ssl-certfile", default=None, help="Path to SSL certificate")
|
@click.option("--ssl-certfile", default=None, help="Path to SSL certificate")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def main(ctx, port: int, host: str, ssl_keyfile: str, ssl_certfile: str):
|
def main(
|
||||||
|
ctx,
|
||||||
|
port: int,
|
||||||
|
host: str,
|
||||||
|
forwarded_allow_ips: str,
|
||||||
|
ssl_keyfile: str,
|
||||||
|
ssl_certfile: str,
|
||||||
|
):
|
||||||
"""Launched with `poetry run lnbits` at root level"""
|
"""Launched with `poetry run lnbits` at root level"""
|
||||||
# this beautiful beast parses all command line arguments and passes them to the uvicorn server
|
# this beautiful beast parses all command line arguments and passes them to the uvicorn server
|
||||||
d = dict()
|
d = dict()
|
||||||
@ -37,6 +45,7 @@ def main(ctx, port: int, host: str, ssl_keyfile: str, ssl_certfile: str):
|
|||||||
"lnbits.__main__:app",
|
"lnbits.__main__:app",
|
||||||
port=port,
|
port=port,
|
||||||
host=host,
|
host=host,
|
||||||
|
forwarded_allow_ips=forwarded_allow_ips,
|
||||||
ssl_keyfile=ssl_keyfile,
|
ssl_keyfile=ssl_keyfile,
|
||||||
ssl_certfile=ssl_certfile,
|
ssl_certfile=ssl_certfile,
|
||||||
**d
|
**d
|
||||||
|
@ -18,6 +18,8 @@ DEBUG = env.bool("DEBUG", default=False)
|
|||||||
HOST = env.str("HOST", default="127.0.0.1")
|
HOST = env.str("HOST", default="127.0.0.1")
|
||||||
PORT = env.int("PORT", default=5000)
|
PORT = env.int("PORT", default=5000)
|
||||||
|
|
||||||
|
FORWARDED_ALLOW_IPS = env.str("FORWARDED_ALLOW_IPS", default="127.0.0.1")
|
||||||
|
|
||||||
LNBITS_PATH = path.dirname(path.realpath(__file__))
|
LNBITS_PATH = path.dirname(path.realpath(__file__))
|
||||||
LNBITS_DATA_FOLDER = env.str(
|
LNBITS_DATA_FOLDER = env.str(
|
||||||
"LNBITS_DATA_FOLDER", default=path.join(LNBITS_PATH, "data")
|
"LNBITS_DATA_FOLDER", default=path.join(LNBITS_PATH, "data")
|
||||||
|
Reference in New Issue
Block a user