mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-11 01:36:11 +01:00
lnbits/server.py: init
This adds a wrapper around uvicorn using Python. This is so the entrypoint lnbits.server can be called on the command line, and passed arguments like port and host. This makes lnbits feel more like a real CLI application, and lends well to running as a service in systemd
This commit is contained in:
parent
50a5f47308
commit
49bd5ad26b
1 changed files with 17 additions and 0 deletions
17
lnbits/server.py
Normal file
17
lnbits/server.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
import uvicorn
|
||||
|
||||
import click
|
||||
|
||||
@click.command()
|
||||
@click.option('--port', default="5000", help='Port to run LNBits on')
|
||||
@click.option('--host', default="127.0.0.1", help='Host to run LNBits on')
|
||||
def main(port, host):
|
||||
"""Launched with `poetry run lnbits` at root level"""
|
||||
uvicorn.run("lnbits.__main__:app", port=port, host=host)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
#def main():
|
||||
# """Launched with `poetry run start` at root level"""
|
||||
# uvicorn.run("lnbits.__main__:app")
|
Loading…
Add table
Reference in a new issue