()
| 39 | } |
| 40 | |
| 41 | func 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 |
| 63 | func getEnv(key string, defaultValue string) string { |
nothing calls this directly
no test coverage detected