Where should I store the database instance after initializing it in go? I want to access them from the request handlers.
// server.go
storage, err := config.GetFileStorage(viper.GetViper())
if err != nil {
log.Fatal(fmt.Sprintf("Failed to configure the file storage: %v
", err))
}
db, err := config.GetDatabase(viper.GetViper())
if err != nil {
log.Fatal(fmt.Sprintf("Failed to configure the database: %v
", err))
}
This are just local variables in the main function. How could I expose them now to the go package with the handlers?