update apphub

This commit is contained in:
zhaojing1987 2024-05-16 08:17:26 +08:00
parent f45ff3ccca
commit 6b867f0743
2 changed files with 22 additions and 13 deletions

View file

@ -1,7 +1,7 @@
[nginx_proxy_manager] [nginx_proxy_manager]
base_url = http://websoft9-proxy:81/api base_url = http://websoft9-proxy:81/api
user_name = help@websoft9.com user_name = admin@mydomain.com
user_pwd = JB21x6AkBshLRK5Y user_pwd = Csj18AHvtBWzuIFA
nike_name = admin nike_name = admin
listen_port = 80 listen_port = 80
@ -9,18 +9,18 @@ listen_port = 80
base_url = http://websoft9-git:3000/api/v1 base_url = http://websoft9-git:3000/api/v1
user_name = websoft9 user_name = websoft9
user_email = admin@mydomain.com user_email = admin@mydomain.com
user_pwd = HZ4RYXr9ce6R user_pwd = vcwIB64zPslu
[portainer] [portainer]
base_url = http://websoft9-deployment:9000/api base_url = http://websoft9-deployment:9000/api
user_name = admin user_name = admin
user_pwd = BDMnVb)gqRKISzfH user_pwd = L@BI75LJ7Shi7oLA
[api_key] [api_key]
key = bd3d92e0f52e299d014c38f8aac7f730602a8a7a41adbee77eddf07b391b9d31 key = bd3d92e0f52e299d014c38f8aac7f730602a8a7a41adbee77eddf07b391b9d31
[domain] [domain]
wildcard_domain = wildcard_domain = test.websoft9.cn
[cockpit] [cockpit]
port = 9000 port = 9000
@ -29,5 +29,5 @@ port = 9000
keys = keys =
[favorite_apps] [favorite_apps]
keys = keys = kibana

View file

@ -3,6 +3,7 @@ import json
import os import os
import shutil import shutil
import random import random
import ipaddress
from datetime import datetime from datetime import datetime
from src.core.config import ConfigManager from src.core.config import ConfigManager
from src.core.envHelper import EnvHelper from src.core.envHelper import EnvHelper
@ -421,10 +422,23 @@ class AppManger:
# Set the password to env file # Set the password to env file
envHelper.set_value("W9_POWER_PASSWORD", PasswordGenerator.generate_strong_password()) envHelper.set_value("W9_POWER_PASSWORD", PasswordGenerator.generate_strong_password())
# Set the settings to env file
if settings:
for key, value in settings.items():
envHelper.set_value(key, value)
# Verify the app is web app # Verify the app is web app
is_web_app = envHelper.get_value("W9_URL") is_web_app = envHelper.get_value("W9_URL")
if is_web_app is not None: url_with_port = envHelper.get_value("W9_URL_WITH_PORT")
if is_web_app is not None and url_with_port is not None:
try:
ipaddress.ip_address(domain_names[0])
envHelper.set_value("W9_URL", domain_names[0] + ":" + envHelper.get_value("W9_HTTP_PORT_SET"))
except ValueError:
envHelper.set_value("W9_URL", domain_names[0])
elif url_with_port is None:
envHelper.set_value("W9_URL", domain_names[0]) envHelper.set_value("W9_URL", domain_names[0])
# validate is bind ip(proxy_enabled is false) # validate is bind ip(proxy_enabled is false)
# if not proxy_enabled: # if not proxy_enabled:
# envHelper.set_value("W9_URL", domain_names[0]) # envHelper.set_value("W9_URL", domain_names[0])
@ -433,12 +447,7 @@ class AppManger:
# replace_domain_name = replace_domain_name.replace(replace_domain_name.split(".")[0], app_id, 1) # replace_domain_name = replace_domain_name.replace(replace_domain_name.split(".")[0], app_id, 1)
# domain_names[0] = replace_domain_name # domain_names[0] = replace_domain_name
# envHelper.set_value("W9_URL", domain_names[0]) # envHelper.set_value("W9_URL", domain_names[0])
# Set the settings to env file
if settings:
for key, value in settings.items():
envHelper.set_value(key, value)
# Commit and push to remote repo # Commit and push to remote repo
self._init_local_repo_and_push_to_remote(app_tmp_dir_path,repo_url) self._init_local_repo_and_push_to_remote(app_tmp_dir_path,repo_url)
except CustomException as e: except CustomException as e: