36 lines
672 B
Python
36 lines
672 B
Python
from src import log
|
|
from src import core
|
|
from src import term
|
|
from src import config
|
|
from src import webcore
|
|
import asyncio
|
|
|
|
log.log_init()
|
|
|
|
|
|
loop = asyncio.new_event_loop()
|
|
|
|
|
|
async def start_cli():
|
|
await log.info("start cli")
|
|
await term.debug_term()
|
|
|
|
|
|
async def start_api():
|
|
await log.info("start webapi")
|
|
await webcore.start()
|
|
|
|
|
|
async def init():
|
|
await log.info("Server start")
|
|
await core.connect_realdb()
|
|
if (config.RUN_MODE == "console"):
|
|
await start_cli()
|
|
elif (config.RUN_MODE == "webapi"):
|
|
await start_api()
|
|
else:
|
|
await log.err("Unknown run mode: "+str(config.RUN_MODE))
|
|
|
|
|
|
loop.run_until_complete(init())
|