fix: stabilize development config and account settings

This commit is contained in:
2026-07-11 17:15:38 +08:00
parent d2cb6bbbc6
commit 7f2d5579ff
19 changed files with 607 additions and 392 deletions
+3
View File
@@ -20,6 +20,9 @@ import (
)
func main() {
config.LoadDotEnvEnvironment()
database.SanitizePostgresEnvironment()
cmd := "serve"
if len(os.Args) > 1 {
cmd = os.Args[1]
+10 -3
View File
@@ -10,6 +10,9 @@ import (
)
func main() {
config.LoadDotEnvEnvironment()
database.SanitizePostgresEnvironment()
if len(os.Args) < 2 {
printUsage()
os.Exit(1)
@@ -17,8 +20,12 @@ func main() {
command := os.Args[1]
// Load config to get database connection info
cfg, err := config.Load()
// Load the same root .env and environment overlay as the application.
env := os.Getenv("GOCHAT_ENV")
if env == "" {
env = "development"
}
cfg, err := config.LoadWithEnv(env)
if err != nil {
fmt.Fprintf(os.Stderr, "Error loading config: %v\n", err)
os.Exit(1)
@@ -106,4 +113,4 @@ func printUsage() {
fmt.Println(" steps <n> Apply n steps (positive=up, negative=down)")
fmt.Println("")
fmt.Println("Environment: Uses database config from Viper (config.yaml)")
}
}