fix: stabilize development config and account settings
This commit is contained in:
@@ -20,6 +20,9 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
config.LoadDotEnvEnvironment()
|
||||
database.SanitizePostgresEnvironment()
|
||||
|
||||
cmd := "serve"
|
||||
if len(os.Args) > 1 {
|
||||
cmd = os.Args[1]
|
||||
|
||||
@@ -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)")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user