-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelayd
executable file
·40 lines (29 loc) · 1.14 KB
/
relayd
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
#!/usr/bin/env python3
# Copyright (c) 2021 Moneysocket Developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
import os
import argparse
import datetime
import logging
from configparser import ConfigParser
from twisted.internet import reactor
from relay.log_setup import setup_logging
from relay.app import Relay
CONFIG_FILE_HELP = """ Configuration settings to app run instance with. """
parser = argparse.ArgumentParser(prog="relay-app.py")
parser.add_argument('-c', '--config', type=str,
default="./conf/relay-example-no-tls.conf",
help=CONFIG_FILE_HELP)
settings = parser.parse_args()
settings.config = os.path.abspath(settings.config)
if not os.path.exists(settings.config):
sys.exit("*** can't use config: %s" % settings.config)
config = ConfigParser()
config.read(settings.config)
now = datetime.datetime.now().strftime("%y%m%d-%H.%M.%S")
logfile = os.path.join(config['Relay']['LogDir'], "relayd-%s.log" % now)
setup_logging(logfile, "relayd", min_level=logging.INFO)
app = Relay(config)
app.run_app()
reactor.run()