diff --git a/core/app.go b/core/app.go index d84fd56..3c9bf25 100644 --- a/core/app.go +++ b/core/app.go @@ -38,7 +38,7 @@ func NewApp() *App { store := sessions.NewCookieStore([]byte(viper.GetString("server.sessionkey"))) serverAPI := options.ServerAPI(options.ServerAPIVersion1) - opts := options.Client().ApplyURI(viper.GetString("db.connectionuri")).SetServerAPIOptions(serverAPI) + opts := options.Client().ApplyURI(viper.GetString("mongodb.uri")).SetServerAPIOptions(serverAPI) // Create a new client and connect to the server client, err := mongo.Connect(context.TODO(), opts) if err != nil { diff --git a/main.go b/main.go index 31ab31e..39626f1 100644 --- a/main.go +++ b/main.go @@ -17,5 +17,7 @@ func main() { viper.SetDefault("server.scheme", "http") viper.SetDefault("server.host", "localhost:5001") + viper.BindEnv("mongodb.uri", "MONGODB_URI") + cmd.Execute() }