Update linting for pvcapid recent changes

This commit is contained in:
Joshua Boniface 2024-09-18 10:18:50 -04:00
parent a2e5df9f6d
commit ecb812ccac
2 changed files with 25 additions and 15 deletions

View File

@ -26,6 +26,6 @@ from os import path
current_dir = path.dirname(path.abspath(__file__))
sys.path.append(current_dir)
import pvcapid.Daemon # noqa: F401
import pvcapid.Daemon # noqa: F401, E402
pvcapid.Daemon.entrypoint()

View File

@ -19,8 +19,6 @@
#
###############################################################################
import sys
import os
import subprocess
from ssl import SSLContext, TLSVersion
from distutils.util import strtobool as dustrtobool
@ -37,6 +35,7 @@ API_VERSION = 1.0
# Helper Functions
##########################################################
def strtobool(stringv):
if stringv is None:
return False
@ -62,6 +61,7 @@ config["daemon_version"] = version
# Flask App Creation for Gunicorn
##########################################################
def create_app():
"""
Create and return the Flask app and SSL context if necessary.
@ -101,8 +101,9 @@ def create_app():
# Entrypoint
##########################################################
def entrypoint():
if config['debug']:
if config["debug"]:
app = create_app()
if config["api_ssl_enabled"]:
@ -124,21 +125,30 @@ def entrypoint():
else:
# Build the command to run Gunicorn
gunicorn_cmd = [
'gunicorn',
'--workers', '1',
'--threads', '8',
'--timeout', '86400',
'--bind', '{}:{}'.format(config["api_listen_address"], config["api_listen_port"]),
'pvcapid.Daemon:create_app()',
'--log-level', 'info',
'--access-logfile', '-',
'--error-logfile', '-',
"gunicorn",
"--workers",
"1",
"--threads",
"8",
"--timeout",
"86400",
"--bind",
"{}:{}".format(config["api_listen_address"], config["api_listen_port"]),
"pvcapid.Daemon:create_app()",
"--log-level",
"info",
"--access-logfile",
"-",
"--error-logfile",
"-",
]
if config["api_ssl_enabled"]:
gunicorn_cmd += [
'--certfile', config["api_ssl_cert_file"],
'--keyfile', config["api_ssl_key_file"]
"--certfile",
config["api_ssl_cert_file"],
"--keyfile",
config["api_ssl_key_file"],
]
# Run Gunicorn