mirror of
https://github.com/thiagoralves/OpenPLC_v3.git
synced 2026-08-19 03:52:52 +08:00
[RTOP-24] Minor fix
This commit is contained in:
@@ -80,10 +80,7 @@ class CertGen():
|
||||
print(f"Certificate saved to {cert_file}")
|
||||
print(f"Private key saved to {key_file}")
|
||||
|
||||
# TODO update certificate on cliente before expiration
|
||||
# TODO add a function to update the certificate on the client before expiration
|
||||
# TODO add a function to check if the certificate is valid (not expired and not yet valid)
|
||||
# TODO add a function to check if the certificate is already generated
|
||||
def is_certificate_valid(self, cert_file):
|
||||
"""
|
||||
Checks if a certificate is valid (not expired and not yet valid).
|
||||
|
||||
+23
-4
@@ -2595,9 +2595,19 @@ def run_https():
|
||||
# Credentials already created
|
||||
else:
|
||||
print("Credentials already generated!")
|
||||
|
||||
context = ('/etc/ssl/certs/certOPENPLC.pem', '/etc/ssl/private/keyOPENPLC.pem')
|
||||
app_restapi.run(debug=False, host='0.0.0.0', threaded=True, port=8443, ssl_context=context)
|
||||
|
||||
try:
|
||||
context = ('/etc/ssl/certs/certOPENPLC.pem', '/etc/ssl/private/keyOPENPLC.pem')
|
||||
app_restapi.run(debug=False, host='0.0.0.0', threaded=True, port=8443, ssl_context=context)
|
||||
except KeyboardInterrupt as e:
|
||||
print(f"Exiting OpenPLC Webserver...{e}")
|
||||
openplc_runtime.stop_runtime()
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
openplc_runtime.stop_runtime()
|
||||
except:
|
||||
print("An unexpected error occurred.")
|
||||
|
||||
# TODO handle file error
|
||||
except FileNotFoundError as e:
|
||||
print(f"Could not find SSL credentials! {e}")
|
||||
@@ -2638,7 +2648,16 @@ def run_http():
|
||||
configure_runtime()
|
||||
monitor.parse_st(openplc_runtime.project_file)
|
||||
|
||||
app.run(debug=False, host='0.0.0.0', threaded=True, port=8080)
|
||||
try:
|
||||
app.run(debug=False, host='0.0.0.0', threaded=True, port=8080)
|
||||
except KeyboardInterrupt as e:
|
||||
print(f"Exiting OpenPLC Webserver...{e}")
|
||||
openplc_runtime.stop_runtime()
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
openplc_runtime.stop_runtime()
|
||||
except:
|
||||
print("An unexpected error occurred.")
|
||||
|
||||
except Error as e:
|
||||
print("error connecting to the database" + str(e))
|
||||
|
||||
Reference in New Issue
Block a user