-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.py
47 lines (32 loc) · 1.01 KB
/
run.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
38
39
40
41
42
43
44
45
46
47
import argparse
import logging
import os
import sys
logging.basicConfig(level=logging.INFO)
assert sys.version_info[0] == 3 and sys.version_info[1] >= 6, "rpc_proxy requires Python 3.6 or newer"
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "src")))
def main():
parser = argparse.ArgumentParser(description='')
cmd_list = (
"proxy",
"test"
)
parser.add_argument("cmd", choices=cmd_list, nargs="?", default="proxy")
parser.add_argument("--config", dest="config")
args = parser.parse_args()
cmd = args.cmd
if cmd == "proxy":
config = args.config
if config is None:
print("--config parameter required!")
exit(1)
from rpc_proxy.config import init_config
from rpc_proxy.app import main
init_config(args.config)
main()
if cmd == "test":
from rpc_proxy.tests import do_tests
os.environ["TESTING"] = "1"
do_tests()
if __name__ == '__main__':
main()