mirror of
https://github.com/makayabou/asg-server.git
synced 2026-05-02 17:43:36 +02:00
[config] expose database pool options to config
This commit is contained in:
parent
83c3ef7bac
commit
1493a05cea
@ -13,6 +13,8 @@ database: # database
|
||||
password: root # database password [DATABASE__PASSWORD]
|
||||
database: sms # database name [DATABASE__DATABASE]
|
||||
timezone: UTC # database timezone (important for message TTL calculation) [DATABASE__TIMEZONE]
|
||||
max_open_conns: 4 # database max open connections (default: 4 * CPU) [DATABASE__MAX_OPEN_CONNS]
|
||||
max_idle_conns: 2 # database max idle connections (default: 2 * CPU) [DATABASE__MAX_IDLE_CONNS]
|
||||
fcm: # firebase cloud messaging config
|
||||
credentials_json: "{}" # firebase credentials json (for public mode only) [FCM__CREDENTIALS_JSON]
|
||||
timeout_seconds: 1 # push notification send timeout [FCM__DEBOUNCE_SECONDS]
|
||||
|
||||
@ -34,6 +34,9 @@ type Database struct {
|
||||
Database string `yaml:"database" envconfig:"DATABASE__DATABASE"` // database name
|
||||
Timezone string `yaml:"timezone" envconfig:"DATABASE__TIMEZONE"` // database timezone
|
||||
Debug bool `yaml:"debug" envconfig:"DATABASE__DEBUG"` // debug mode
|
||||
|
||||
MaxOpenConns int `yaml:"max_open_conns" envconfig:"DATABASE__MAX_OPEN_CONNS"` // max open connections
|
||||
MaxIdleConns int `yaml:"max_idle_conns" envconfig:"DATABASE__MAX_IDLE_CONNS"` // max idle connections
|
||||
}
|
||||
|
||||
type FCMConfig struct {
|
||||
|
||||
@ -42,6 +42,9 @@ var Module = fx.Module(
|
||||
Database: cfg.Database.Database,
|
||||
Timezone: cfg.Database.Timezone,
|
||||
Debug: cfg.Database.Debug,
|
||||
|
||||
MaxOpenConns: cfg.Database.MaxOpenConns,
|
||||
MaxIdleConns: cfg.Database.MaxIdleConns,
|
||||
}
|
||||
}),
|
||||
fx.Provide(func(cfg Config) push.Config {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user