This commit is contained in:
2025-01-16 00:17:11 +01:00
committed by Kevin Midboe
commit b4f3ec3343
13 changed files with 621 additions and 0 deletions

26
config/config.go Normal file
View File

@@ -0,0 +1,26 @@
package config
import (
"log"
"github.com/joho/godotenv"
"github.com/kelseyhightower/envconfig"
)
// Config contains environment variables.
type Config struct {
EtcdEndpoint string `envconfig:"ETCD_ENDPOINTS"`
}
// LoadConfig reads environment variables, populates and returns Config.
func LoadConfig() (*Config, error) {
if err := godotenv.Load(); err != nil {
log.Println("No .env file found")
}
var c Config
err := envconfig.Process("", &c)
return &c, err
}