Refactor: Extract export_ql_envs function and move env.sh sourcing earlier

Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-11-14 14:42:00 +00:00
parent dc266e3148
commit 9a877ddc22

View File

@ -3,6 +3,13 @@
dir_shell=/ql/shell
. $dir_shell/share.sh
export_ql_envs() {
# Export BACK_PORT from QlPort for backend server to use
export BACK_PORT="${ql_port}"
# Export GRPC_PORT from QlGrpcPort for gRPC server to use
export GRPC_PORT="${ql_grpc_port}"
}
log_with_style() {
local level="$1"
local message="$2"
@ -13,15 +20,9 @@ log_with_style() {
log_with_style "INFO" "🚀 1. 检测配置文件..."
import_config "$@"
# Export BACK_PORT from QlPort for backend server to use
export BACK_PORT="${ql_port}"
# Export GRPC_PORT from QlGrpcPort for gRPC server to use
export GRPC_PORT="${ql_grpc_port}"
fix_config
# Source env.sh after all config is complete to capture all environment variables
export_ql_envs
. $dir_shell/env.sh
fix_config
pm2 l &>/dev/null