refs #1198 adds ogcore port to url and creates log dir in clients

ogboot-log
Luis Gerardo Romero Garcia 2024-11-28 08:44:17 +01:00
parent fe2b505283
commit 57cd399905
1 changed files with 11 additions and 3 deletions

View File

@ -23,7 +23,15 @@ config_file = os.path.join(PROGRAM_DIR, 'config.json')
with open(config_file, 'r') as f:
config = json.load(f)
OGCORE_IP = config["ogCore_ServerIP"]
#OGCORE_IP = config["ogCore_ServerIP"]
ogcore_ip_port = config['ogCore_ServerIP']
if ':' in ogcore_ip_port:
OGCORE_IP, OGCORE_PORT = ogcore_ip_port.split(':')
else:
OGCORE_IP = ogcore_ip_port
OGCORE_PORT = "8443"
#Para el caso de que pasen una ip con puerto separamos la ip y el puerto
#Pasamos el puerto para conexiones por http
#No pasamos el puerto para conexiones tftp y parámetros del kernel
@ -250,8 +258,8 @@ def og_boot_symfony_install():
shutil.chown(composer_dest, user='opengnsys', group='opengnsys')
logger.info(f"Set permissions and owner for {env_dest} and {composer_dest}")
# Añadir la línea OGCORE_API_URL utilizando OGCORE_IP
ogcore_api_url = f'OGCORE_API_URL="https://{OGCORE_IP}"'
# Añadir la línea OGCORE_API_URL utilizando OGCORE_IP y OGCORE_PORT
ogcore_api_url = f'OGCORE_API_URL="https://{OGCORE_IP}:{OGCORE_PORT}"'
with open(env_dest, 'a') as env_file:
env_file.write(f"\n{ogcore_api_url}\n")
logger.info(f"Added OGCORE_API_URL to {env_dest} with IP: {OGCORE_IP}")