From d8779ed5bf9ce3c0518d93055585d92928bfbb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E9=97=BB=E9=A3=8E?= Date: Tue, 23 Jun 2026 14:57:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=89=E8=A3=85=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 7 ++++++- install_linux.sh | 8 ++++++-- main.go | 7 ++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/config/config.go b/config/config.go index 89caf4e..cb94946 100644 --- a/config/config.go +++ b/config/config.go @@ -78,8 +78,13 @@ func getDefaultSocketPath() string { return "" } // LoadConfig reads the config file or creates one with defaults. -func LoadConfig() *Config { +// If customPath is non-empty, it overrides the OS-aware config file path. +func LoadConfig(customPath string) *Config { configDir, configFile := getConfigPath() + if customPath != "" { + configFile = customPath + configDir = filepath.Dir(configFile) + } defaultPath := getDefaultStoragePath() // Check if config file exists; create with defaults if not. diff --git a/install_linux.sh b/install_linux.sh index 3464852..79801ef 100755 --- a/install_linux.sh +++ b/install_linux.sh @@ -42,13 +42,17 @@ chmod 0755 "${INSTALL_DIR}" find "${INSTALL_DIR}/templates" -type d -exec chmod 0755 {} \; find "${INSTALL_DIR}/templates" -type f -exec chmod 0644 {} \; +SOCKET_PATH="${INSTALL_DIR}/web.sock" + if [[ ! -f "${CONFIG_DIR}/config.yaml" ]]; then SECRET=$(openssl rand -hex 32) cat > "${CONFIG_DIR}/config.yaml" <