diff --git a/api-daemon/pvcapid.py b/api-daemon/pvcapid.py index 79a852c4..2caaf148 100755 --- a/api-daemon/pvcapid.py +++ b/api-daemon/pvcapid.py @@ -20,4 +20,4 @@ # ############################################################################### -import pvcapid.api +import pvcapid.Daemon diff --git a/api-daemon/pvcapid/api.py b/api-daemon/pvcapid/Daemon.py similarity index 99% rename from api-daemon/pvcapid/api.py rename to api-daemon/pvcapid/Daemon.py index 043b26f6..bd088e4e 100755 --- a/api-daemon/pvcapid/api.py +++ b/api-daemon/pvcapid/Daemon.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# api.py - PVC HTTP API interface +# Daemon.py - PVC HTTP API daemon # Part of the Parallel Virtual Cluster (PVC) system # # Copyright (C) 2018-2020 Joshua M. Boniface @@ -5612,25 +5612,24 @@ api.add_resource(API_Provisioner_Status_Element, '/provisioner/status/' ########################################################## # Entrypoint ########################################################## -if __name__ == '__main__': - if config['debug']: - # Run in Flask standard mode - app.run(config['listen_address'], config['listen_port']) +if config['debug']: + # Run in Flask standard mode + app.run(config['listen_address'], config['listen_port']) +else: + if config['ssl_enabled']: + # Run the WSGI server with SSL + http_server = gevent.pywsgi.WSGIServer( + (config['listen_address'], config['listen_port']), + app, + keyfile=config['ssl_key_file'], + certfile=config['ssl_cert_file'] + ) else: - if config['ssl_enabled']: - # Run the WSGI server with SSL - http_server = gevent.pywsgi.WSGIServer( - (config['listen_address'], config['listen_port']), - app, - keyfile=config['ssl_key_file'], - certfile=config['ssl_cert_file'] - ) - else: - # Run the ?WSGI server without SSL - http_server = gevent.pywsgi.WSGIServer( - (config['listen_address'], config['listen_port']), - app - ) + # Run the ?WSGI server without SSL + http_server = gevent.pywsgi.WSGIServer( + (config['listen_address'], config['listen_port']), + app + ) - print('Starting PyWSGI server at {}:{} with SSL={}, Authentication={}'.format(config['listen_address'], config['listen_port'], config['ssl_enabled'], config['auth_enabled'])) - http_server.serve_forever() + print('Starting PyWSGI server at {}:{} with SSL={}, Authentication={}'.format(config['listen_address'], config['listen_port'], config['ssl_enabled'], config['auth_enabled'])) + http_server.serve_forever()