Adds argument parsing & provides entrypoint for starting app
This commit is contained in:
parent
99ff987dad
commit
6512ec78cd
1 changed files with 15 additions and 4 deletions
19
src/main.py
19
src/main.py
|
@ -1,6 +1,8 @@
|
|||
import logging.config
|
||||
import logging
|
||||
import os
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from src.settings import config
|
||||
from src.server.app import run_app
|
||||
|
||||
|
@ -68,7 +70,16 @@ def config_logging_from_settings(conf):
|
|||
logging.config.dictConfig(_config)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main(argv=None):
|
||||
argv = argv or sys.argv[1:]
|
||||
parser = argparse.ArgumentParser(description='LBRY Comment Server')
|
||||
parser.add_argument('--port', type=int)
|
||||
args = parser.parse_args(argv)
|
||||
if args.port:
|
||||
config['PORT'] = args.port
|
||||
config_logging_from_settings(config)
|
||||
logger = logging.getLogger(__name__)
|
||||
run_app(config)
|
||||
run_app(config)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
Loading…
Reference in a new issue