-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·37 lines (32 loc) · 1.03 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import argparse
import os
from lib.config import Config
from server import Server
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Process config')
parser.add_argument('--config', help='Config path', required=False)
parser.add_argument(
'--log-level',
help='Log level, error/warning/info/debug, default: info',
required=False,
default='info')
parser.add_argument(
'--port',
help='Port to serve on, default: 80',
required=False,
default=80)
parser.add_argument(
'--create-config',
help='Create standard config file',
action='store_true',
default=False)
if parser.parse_args().create_config:
Config.create_standard_config_file(
os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'default.conf'))
exit()
server = Server(
parser.parse_args().port,
parser.parse_args().config,
parser.parse_args().log_level)
server.start_server()