Added a simple data model class to be more flexible. SQLAlchemy will not be included. uplink is to small for this... maybe later. Lot of housekeeping where done too.

This commit is contained in:
Johannes Findeisen 2022-08-28 04:17:53 +02:00
commit d2f3484ca9
8 changed files with 279 additions and 62 deletions

View file

@ -25,8 +25,6 @@
# TODO: Implement a speedtest/ping that will also run regularly but in an individual interval
# TODO: become more verbose in each log level and log only to error when it really is an error
# else log to info and even add debug messages in DEBUG level
# TODO: Maybe make path to pid_file an arg to use /var/run/user/$uid/uplink.pid instead of
# /tmp/uplink.pid or check user id and write it to /var/run or var/run/user/$uid automatically
# TODO: make all args consistent and clean... there is some stuff to do!
import argparse
@ -113,7 +111,7 @@ def main():
args = parse_args()
root_logger = logging.getLogger()
logger.error("TEST")
if args.logfile:
logfile = os.path.expanduser(args.logfile)
if not os.path.exists(os.path.dirname(logfile)):
@ -143,7 +141,7 @@ def main():
configuration.set_env_var('_start_date', time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(
calendar.timegm(time.gmtime()))))
calendar.timegm(time.gmtime()))))
# interval set in args is overriding configuration and default
if args.interval:
@ -177,17 +175,17 @@ def main():
if configuration.get_httpserver_framework() == 'bottle':
from uplink.server_bottle import Server
s = Server(configuration)
st = Thread(target=s.run, daemon=True)
st = Thread(target=s.run_server, daemon=True)
st.start()
elif configuration.get_httpserver_framework() == 'cherrypy':
from uplink.server_cherrypy import Server
s = Server(configuration)
st = Thread(target=s.run, daemon=True)
st = Thread(target=s.run_server, daemon=True)
st.start()
elif configuration.get_httpserver_framework() == 'pyramid':
from uplink.server_pyramid import Server
s = Server(configuration)
st = Thread(target=s.run, daemon=True)
st = Thread(target=s.run_server, daemon=True)
st.start()
else:
logger.error('[uplink] no http framework configured! '