From 911c1bbc8acfc9b04aebb95dba68fa697714e555 Mon Sep 17 00:00:00 2001 From: zhouyonggao <1971162852@qq.com> Date: Thu, 27 Nov 2025 16:57:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AF=86=E7=A0=81=E5=B9=B6=E7=A7=BB=E9=99=A4=E5=BA=9F?= =?UTF-8?q?=E5=BC=83=E7=9A=84env=E5=8A=A0=E8=BD=BD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.yaml | 2 +- server/internal/config/env.go | 45 ----------------------------------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 server/internal/config/env.go diff --git a/server/config.yaml b/server/config.yaml index 699a0cd..a292272 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -10,5 +10,5 @@ app: host: "47.97.27.195" port: "3306" user: "root" - password: "lansexiongdi," + password: "lansexiongdi6," name: "merketing" diff --git a/server/internal/config/env.go b/server/internal/config/env.go deleted file mode 100644 index cf4d2ac..0000000 --- a/server/internal/config/env.go +++ /dev/null @@ -1,45 +0,0 @@ -package config - -import ( - "bufio" - "os" - "path/filepath" - "strings" -) - -func LoadEnv() { - paths := []string{ - ".env.local", - filepath.Join("server", ".env.local"), - } - for _, p := range paths { - if loadFile(p) { - return - } - } -} - -func loadFile(path string) bool { - f, err := os.Open(path) - if err != nil { - return false - } - defer f.Close() - s := bufio.NewScanner(f) - for s.Scan() { - line := strings.TrimSpace(s.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - idx := strings.Index(line, "=") - if idx <= 0 { - continue - } - k := strings.TrimSpace(line[:idx]) - v := strings.TrimSpace(line[idx+1:]) - if _, ok := os.LookupEnv(k); !ok || os.Getenv(k) == "" { - os.Setenv(k, v) - } - } - return true -}