full server dashboard working
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import yaml
|
||||
from urllib.parse import urlparse
|
||||
#######################################################################
|
||||
### Settings Handler Functions
|
||||
#######################################################################
|
||||
@ -32,8 +33,9 @@ with open('cosmostat_settings.yaml', 'r') as f:
|
||||
app_settings[setting] = cosmos_setting
|
||||
print("...Done")
|
||||
|
||||
|
||||
# this returns the docker gateway from the settings
|
||||
def docker_gateway_settings() -> str:
|
||||
def cosmostat_bind_ip() -> str:
|
||||
return cosmostat_settings["docker_gateway"]
|
||||
|
||||
# this returns the jenkins user that ran the pipeline
|
||||
@ -51,9 +53,23 @@ def jenkins_inventory_generation_timestamp_settings() -> str:
|
||||
def run_cosmostat_server():
|
||||
return cosmostat_settings["cosmostat_server"]
|
||||
|
||||
def run_cosmostat_reporter():
|
||||
result = False
|
||||
if not cosmostat_settings["cosmostat_server"] and cosmostat_settings["cosmostat_server_reporter"]:
|
||||
result = True
|
||||
return result
|
||||
|
||||
def service_gateway_ip():
|
||||
result = "0.0.0.0"
|
||||
if cosmostat_settings["cosmostat_server"]:
|
||||
result = urlparse(cosmostat_settings["cosmostat_server_api"]).hostname
|
||||
elif cosmostat_settings["secure_api"]:
|
||||
result = cosmostat_bind_ip()
|
||||
return result
|
||||
|
||||
def redis_gateway_ip():
|
||||
if cosmostat_settings["secure_api"]:
|
||||
return docker_gateway_settings()
|
||||
return cosmostat_bind_ip()
|
||||
else:
|
||||
return "0.0.0.0"
|
||||
|
||||
@ -63,7 +79,7 @@ def cosmostat_server_api():
|
||||
def service_api_port():
|
||||
return cosmostat_settings["custom_api_port"]
|
||||
|
||||
def log_data(log_output:str, log_level = cosmostat_settings["noisy_test"]):
|
||||
def log_data(log_output:str, log_level = "noisy_test"):
|
||||
log_levels = [
|
||||
"noisy_test",
|
||||
"debug_output",
|
||||
@ -76,6 +92,9 @@ def log_data(log_output:str, log_level = cosmostat_settings["noisy_test"]):
|
||||
else:
|
||||
print(f"Warning - {log_level} not valid log level")
|
||||
|
||||
if app_settings["cosmostat_server"]:
|
||||
app_settings["cosmostat_server_reporter"] = False
|
||||
log_data(log_output = "Warning - server and reporter cannot run concurrently, server is prioritized.", log_level = cosmostat_settings["log_output"])
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user