Add wuttapos serve
command
b/c it apparently is just that easy..
This commit is contained in:
parent
27dca66a0f
commit
a0915f7d5c
|
@ -40,4 +40,5 @@ console_scripts =
|
|||
|
||||
wuttapos.commands =
|
||||
open = wuttapos.commands:Open
|
||||
serve = wuttapos.commands:Serve
|
||||
status = wuttapos.commands:Status
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
WuttaPOS commands
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from rattail import commands
|
||||
|
@ -31,6 +32,9 @@ from rattail import commands
|
|||
from wuttapos import __version__
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def main(*args):
|
||||
"""
|
||||
Main entry point for WuttaPOS command system
|
||||
|
@ -63,6 +67,26 @@ class Open(commands.Subcommand):
|
|||
run_app(self.config)
|
||||
|
||||
|
||||
class Serve(commands.Subcommand):
|
||||
"""
|
||||
Run the POS app as a web service
|
||||
"""
|
||||
name = 'serve'
|
||||
description = __doc__.strip()
|
||||
|
||||
def run(self, args):
|
||||
import flet as ft
|
||||
from wuttapos.app import main
|
||||
|
||||
host = self.config.get('wuttapos', 'serve.host',
|
||||
default='0.0.0.0')
|
||||
port = self.config.getint('wuttapos', 'serve.port',
|
||||
default=8332)
|
||||
|
||||
log.info(f"will serve WuttaPOS on http://{host}:{port}")
|
||||
ft.app(target=main, view=None, host=host, port=port)
|
||||
|
||||
|
||||
class Status(commands.Subcommand):
|
||||
"""
|
||||
Show status of the POS lane
|
||||
|
|
Loading…
Reference in a new issue