Added notification stub, lot of refactoring, set default http_server_host to 127.0.0.1 and bug fixes.

This commit is contained in:
Johannes Findeisen 2022-09-06 02:51:54 +02:00
commit 03424821c8
4 changed files with 139 additions and 50 deletions

View file

@ -36,7 +36,7 @@ import time
from uplink.configuration import Configuration
from uplink.uplink import Uplink
__version__ = '0.7.0'
__version__ = '0.8.0'
__author__ = 'Johannes Findeisen <you@hanez.org>'
logger = logging.getLogger(__name__)
@ -98,10 +98,9 @@ def main():
logger.error(str('[uplink] configuration error! {0}'.format(err)))
sys.exit(1)
configuration.set_env_var('_start_date', time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(
calendar.timegm(time.gmtime()))))
configuration.set_env_var('_start_timestamp', calendar.timegm(time.gmtime()))
configuration.set_env_var('_internal_start_date', time.strftime('%Y-%m-%d %H:%M:%S',
time.localtime(calendar.timegm(time.gmtime()))))
configuration.set_env_var('_internal_start_timestamp', calendar.timegm(time.gmtime()))
# interval set in args is overriding configuration and default
if args.interval:
@ -139,7 +138,7 @@ def main():
root_logger.setLevel(logging.DEBUG)
if args.httpserver or configuration.get_httpserver():
configuration.set_env_var('_httpserver', True)
configuration.set_httpserver(True)
try:
u = Uplink(configuration.get_pid_file(), configuration)
@ -161,7 +160,7 @@ def main():
u.start()
elif args.foreground:
from threading import Thread
if configuration.get_env_var('_httpserver'):
if configuration.get_httpserver():
from uplink.httpserver import HTTPServer
s = HTTPServer(configuration)
st = Thread(target=s.run_server, daemon=True)