MCPcopy Create free account
hub / github.com/andersonmarquesgit/chargeback / LoadConfig

Function LoadConfig

chargeback-api/internal/config/config.go:41–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39}
40
41func LoadConfig() *Config {
42 return &Config{
43 Server: ServerConfig{
44 Port: getEnv("SERVER_PORT", "80"),
45 ReadTimeout: getEnvAsDuration("SERVER_READ_TIMEOUT", 15*time.Second),
46 WriteTimeout: getEnvAsDuration("SERVER_WRITE_TIMEOUT", 15*time.Second),
47 },
48 Database: DatabaseConfig{
49 CassandraHosts: strings.Split(getEnv("CASSANDRA_HOSTS", "127.0.0.1"), ","),
50 Keyspace: getEnv("CASSANDRA_KEYSPACE", "chargebacks"),
51 },
52 RabbitMQ: RabbitMQConfig{
53 URL: getEnv("RABBITMQ_URL", "amqp://guest:guest@localhost:5672"),
54 },
55 NewRelic: NewRelicConfig{
56 LicenseKey: getEnv("NEW_RELIC_LICENSE_KEY", ""),
57 Enabled: getEnvAsBool("NEW_RELIC_ENABLED", false),
58 },
59 }
60}
61
62// Funções auxiliares para carregar variáveis de ambiente
63func getEnv(key string, defaultValue string) string {

Callers

nothing calls this directly

Calls 3

getEnvFunction · 0.70
getEnvAsDurationFunction · 0.70
getEnvAsBoolFunction · 0.70

Tested by

no test coverage detected