()
| 56 | } |
| 57 | |
| 58 | func LoadConfig() *Config { |
| 59 | return &Config{ |
| 60 | Server: ServerConfig{ |
| 61 | Port: getEnv("SERVER_PORT", "81"), |
| 62 | ReadTimeout: getEnvAsDuration("SERVER_READ_TIMEOUT", 15*time.Second), |
| 63 | WriteTimeout: getEnvAsDuration("SERVER_WRITE_TIMEOUT", 15*time.Second), |
| 64 | }, |
| 65 | Database: DatabaseConfig{ |
| 66 | CassandraHosts: strings.Split(getEnv("CASSANDRA_HOSTS", "127.0.0.1"), ","), |
| 67 | Keyspace: getEnv("CASSANDRA_KEYSPACE", "chargebacks"), |
| 68 | }, |
| 69 | RabbitMQ: RabbitMQConfig{ |
| 70 | URL: getEnv("RABBITMQ_URL", "amqp://guest:guest@localhost:5672"), |
| 71 | }, |
| 72 | NewRelic: NewRelicConfig{ |
| 73 | LicenseKey: getEnv("NEW_RELIC_LICENSE_KEY", ""), |
| 74 | Enabled: getEnvAsBool("NEW_RELIC_ENABLED", false), |
| 75 | }, |
| 76 | Chargeback: ChargebackConfig{ |
| 77 | OutputDir: getEnv("CHARGEBACK_OUTPUT_DIR", "/tmp/chargebacks"), |
| 78 | MaxDuration: getEnvAsDurationWithUnit( |
| 79 | "CHARGEBACK_MAX_DURATION_VALUE", |
| 80 | "CHARGEBACK_MAX_DURATION_UNIT", |
| 81 | 30*time.Second, |
| 82 | ), |
| 83 | MaxRecords: getEnvAsInt("CHARGEBACK_MAX_RECORDS", 5), |
| 84 | }, |
| 85 | Minio: MinioConfig{ |
| 86 | Endpoint: getEnv("MINIO_ENDPOINT", "localhost:9000"), |
| 87 | AccessKey: getEnv("MINIO_ACCESS_KEY", "admin"), |
| 88 | SecretKey: getEnv("MINIO_SECRET_KEY", "password"), |
| 89 | UseSSL: false, // ou converter com strconv.ParseBool |
| 90 | BucketName: getEnv("MINIO_BUCKET_NAME", "chargebacks"), |
| 91 | }, |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // Funções auxiliares para carregar variáveis de ambiente |
| 96 | func getEnv(key string, defaultValue string) string { |
nothing calls this directly
no test coverage detected