sonarqube-badges/config/config.go

24 lines
479 B
Go
Raw Normal View History

2025-03-13 08:25:39 +01:00
package config
import (
"context"
"github.com/kelseyhightower/envconfig"
)
type Config struct {
2025-03-15 01:49:52 +01:00
SqHost string `envconfig:"SQ_HOST"`
Secret string `envconfig:"SECRET"`
DataPath string `envconfig:"DATA_PATH"`
Port int `envconfig:"PORT"`
2025-03-13 08:25:39 +01:00
}
func ProcessConfiguration(ctx context.Context) context.Context {
var cfg Config
err := envconfig.Process("", &cfg)
if err != nil {
panic("failed to process config")
}
return context.WithValue(ctx, "config", cfg)
}