func (dbConf *DbConfig) parseConfig() { if os.Getenv("GO_ENV") != "production" { err := godotenv.Load() if err != nil { log.Fatal("Error loading .env file") } } // Expected Url to be in the following format // "mongodb://localhost:27017" // mongodb://myuser:mypass@localhost:40001,otherhost:40001/mydb // To Be Implemented // dbConf := DbConfig{Host: os.Getenv("MONGO_HOST"), // Database: os.Getenv("MONGO_DB"), // Username: os.Getenv("MONGO_USERNAME"), // Password: os.Getenv("MONGO_PASSWORD"), // TestDatabase: os.Getenv("MONGO_TEST_DB")} dbConf.Url = os.Getenv("MONGO_URL") if dbConf.Url == "" { dbConf.Url = "mongodb://localhost:27017/mesh-models-api-dev" } }
func init() { godotenv.Load() }