feat(t229): load ERP credentials from dotenv

This commit is contained in:
QiuSW
2026-07-29 10:25:56 +08:00
parent d75a7d8dc0
commit f0fbdbaddc
12 changed files with 396 additions and 26 deletions
+15 -1
View File
@@ -34,7 +34,7 @@ func main() {
}
func run() error {
cfg, err := config.Load(os.LookupEnv)
cfg, err := loadConfig(os.LookupEnv, config.DefaultERPEnvironmentFile)
if err != nil {
return err
}
@@ -93,6 +93,20 @@ func run() error {
}
}
func loadConfig(
lookup config.LookupEnvironment,
environmentFile string,
) (config.Config, error) {
effectiveLookup, err := config.WithERPEnvironmentFile(
environmentFile,
lookup,
)
if err != nil {
return config.Config{}, err
}
return config.Load(effectiveLookup)
}
func shutdownServer(
server *http.Server,
serverErrors <-chan error,