mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-12-05 01:48:48 +00:00
feat: Add configuration for payment processing, charging engine, metrics, and time-series storage
- Add PaymentConfig with Stripe API key and webhook secret fields - Add ChargingEngineConfig with base URL and timeout settings - Add InfluxDBConfig with URL, token, org, and bucket fields - Add MetricsPort field to ServerConfig for Prometheus metrics endpoint - Set default values: MetricsPort 9090, ChargingEngine localhost:3001, InfluxDB localhost:8086 - Update Config struct to include Payment, ChargingEngine, and Infl
This commit is contained in:
@@ -5,15 +5,30 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Server ServerConfig `json:"server"`
|
Server ServerConfig `json:"server"`
|
||||||
Database DatabaseConfig `json:"database"`
|
Database DatabaseConfig `json:"database"`
|
||||||
Redis RedisConfig `json:"redis"`
|
Redis RedisConfig `json:"redis"`
|
||||||
IMSI IMSIConfig `json:"imsi"`
|
IMSI IMSIConfig `json:"imsi"`
|
||||||
ES2 ES2Config `json:"es2"`
|
ES2 ES2Config `json:"es2"`
|
||||||
|
Payment PaymentConfig `json:"payment"`
|
||||||
|
ChargingEngine ChargingEngineConfig `json:"charging_engine"`
|
||||||
|
InfluxDB InfluxDBConfig `json:"influxdb"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChargingEngineConfig struct {
|
||||||
|
BaseURL string `json:"base_url"`
|
||||||
|
Timeout time.Duration `json:"timeout"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PaymentConfig struct {
|
||||||
|
Provider string `json:"provider"`
|
||||||
|
StripeAPIKey string `json:"stripe_api_key"`
|
||||||
|
StripeWebhookSecret string `json:"stripe_webhook_secret"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
Port string `json:"port"`
|
Port string `json:"port"`
|
||||||
|
MetricsPort string `json:"metrics_port"`
|
||||||
ReadTimeout time.Duration `json:"read_timeout"`
|
ReadTimeout time.Duration `json:"read_timeout"`
|
||||||
WriteTimeout time.Duration `json:"write_timeout"`
|
WriteTimeout time.Duration `json:"write_timeout"`
|
||||||
}
|
}
|
||||||
@@ -35,15 +50,22 @@ type RedisConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IMSIConfig struct {
|
type IMSIConfig struct {
|
||||||
Prefix string `json:"prefix"`
|
Prefix string `json:"prefix"`
|
||||||
MinIMSI uint64 `json:"min_imsi"`
|
MinIMSI uint64 `json:"min_imsi"`
|
||||||
MaxIMSI uint64 `json:"max_imsi"`
|
MaxIMSI uint64 `json:"max_imsi"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type InfluxDBConfig struct {
|
||||||
|
URL string `json:"url"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
Org string `json:"org"`
|
||||||
|
Bucket string `json:"bucket"`
|
||||||
|
}
|
||||||
|
|
||||||
type ES2Config struct {
|
type ES2Config struct {
|
||||||
BaseURL string `json:"base_url"`
|
BaseURL string `json:"base_url"`
|
||||||
APIKey string `json:"api_key"`
|
APIKey string `json:"api_key"`
|
||||||
InsecureSkipVerify bool `json:"insecure_skip_verify"`
|
InsecureSkipVerify bool `json:"insecure_skip_verify"`
|
||||||
FunctionalityRequesterID string `json:"functionality_requester_id"`
|
FunctionalityRequesterID string `json:"functionality_requester_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +73,7 @@ func LoadConfig() *Config {
|
|||||||
return &Config{
|
return &Config{
|
||||||
Server: ServerConfig{
|
Server: ServerConfig{
|
||||||
Port: "8000",
|
Port: "8000",
|
||||||
|
MetricsPort: "9090",
|
||||||
ReadTimeout: 30 * time.Second,
|
ReadTimeout: 30 * time.Second,
|
||||||
WriteTimeout: 30 * time.Second,
|
WriteTimeout: 30 * time.Second,
|
||||||
},
|
},
|
||||||
@@ -69,15 +92,30 @@ func LoadConfig() *Config {
|
|||||||
DB: 0,
|
DB: 0,
|
||||||
},
|
},
|
||||||
IMSI: IMSIConfig{
|
IMSI: IMSIConfig{
|
||||||
Prefix: "20893", // France MCC+MNC
|
Prefix: "20893", // France MCC+MNC
|
||||||
MinIMSI: 1,
|
MinIMSI: 1,
|
||||||
MaxIMSI: 999999999,
|
MaxIMSI: 999999999,
|
||||||
},
|
},
|
||||||
ES2: ES2Config{
|
ES2: ES2Config{
|
||||||
BaseURL: "https://smdp.example.com",
|
BaseURL: "https://smdp.example.com",
|
||||||
APIKey: "",
|
APIKey: "",
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
FunctionalityRequesterID: "telecom-platform",
|
FunctionalityRequesterID: "telecom-platform",
|
||||||
},
|
},
|
||||||
|
Payment: PaymentConfig{
|
||||||
|
Provider: "stripe",
|
||||||
|
StripeAPIKey: "",
|
||||||
|
StripeWebhookSecret: "",
|
||||||
|
},
|
||||||
|
ChargingEngine: ChargingEngineConfig{
|
||||||
|
BaseURL: "http://localhost:3001",
|
||||||
|
Timeout: 10 * time.Second,
|
||||||
|
},
|
||||||
|
InfluxDB: InfluxDBConfig{
|
||||||
|
URL: "http://localhost:8086",
|
||||||
|
Token: "",
|
||||||
|
Org: "telecom",
|
||||||
|
Bucket: "telecom",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user