23 lines
318 B
Go
23 lines
318 B
Go
package config
|
|
|
|
import "os"
|
|
|
|
type Config struct {
|
|
Port string
|
|
APIKey string
|
|
}
|
|
|
|
func Load() *Config {
|
|
return &Config{
|
|
Port: getEnv("PORT", "8080"),
|
|
APIKey: os.Getenv("WB_API_KEY"),
|
|
}
|
|
}
|
|
|
|
func getEnv(key, defaultVal string) string {
|
|
if val := os.Getenv(key); val != "" {
|
|
return val
|
|
}
|
|
return defaultVal
|
|
}
|