mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-05 04:32:04 +02:00
argparser respect boolean arguments (#842)
This commit is contained in:
parent
48a57513f4
commit
9b27c2da01
@ -20,15 +20,19 @@ from lnbits.settings import HOST, PORT
|
|||||||
def main(ctx, port: int, host: str, ssl_keyfile: str, ssl_certfile: str):
|
def main(ctx, port: int, host: 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()
|
||||||
[
|
for a in ctx.args:
|
||||||
(
|
item = a.split("=")
|
||||||
item[0].strip("--").replace("-", "_"),
|
if len(item) > 1: # argument like --key=value
|
||||||
int(item[1]) if item[1].isdigit() else item[1],
|
print(a, item)
|
||||||
|
d[item[0].strip("--").replace("-", "_")] = (
|
||||||
|
int(item[1]) # need to convert to int if it's a number
|
||||||
|
if item[1].isdigit()
|
||||||
|
else item[1]
|
||||||
)
|
)
|
||||||
for item in zip(*[iter(ctx.args)] * 2)
|
else:
|
||||||
]
|
d[a.strip("--")] = True # argument like --key
|
||||||
)
|
|
||||||
config = uvicorn.Config(
|
config = uvicorn.Config(
|
||||||
"lnbits.__main__:app",
|
"lnbits.__main__:app",
|
||||||
port=port,
|
port=port,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user