2017-11-09 19:34:58 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/8thlight/vulcanizedb/pkg/config"
|
2017-12-04 15:53:36 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/pkg/repositories"
|
2017-11-09 19:34:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func LoadConfig(environment string) config.Config {
|
|
|
|
cfg, err := config.NewConfig(environment)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Error loading config\n%v", err)
|
|
|
|
}
|
2017-12-04 16:17:13 +00:00
|
|
|
return cfg
|
2017-11-09 19:34:58 +00:00
|
|
|
}
|
2017-12-04 15:53:36 +00:00
|
|
|
|
|
|
|
func LoadPostgres(database config.Database) repositories.Postgres {
|
|
|
|
repository, err := repositories.NewPostgres(database)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Error loading postgres\n%v", err)
|
|
|
|
}
|
|
|
|
return repository
|
|
|
|
}
|