39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package config
|
|
|
|
import "time"
|
|
|
|
type Config struct {
|
|
App AppConfig `mapstructure:"app"`
|
|
JWT JwtConfig `mapstructure:"jwt"`
|
|
UniqueID UniqueIDConfig `mapstructure:"unique_id"`
|
|
Postgres PostgresConfig `mapstructure:"postgres"`
|
|
}
|
|
|
|
type AppConfig struct {
|
|
Name string `mapstructure:"name"`
|
|
Port int `mapstructure:"port"`
|
|
}
|
|
|
|
type PostgresConfig struct {
|
|
Host string `mapstructure:"host"`
|
|
Port int `mapstructure:"port"`
|
|
User string `mapstructure:"user"`
|
|
Password string `mapstructure:"password"`
|
|
Dbname string `mapstructure:"dbname"`
|
|
SslMode bool `mapstructure:"ssl_mode"`
|
|
TimeZone string `mapstructure:"timezone"`
|
|
MaxOpenConns int32 `mapstructure:"max_open_conns"`
|
|
MaxIdleConns int32 `mapstructure:"max_idle_conns"`
|
|
ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime"`
|
|
}
|
|
|
|
type JwtConfig struct {
|
|
Secret string `mapstructure:"secret"`
|
|
AccessExpiry time.Duration `mapstructure:"access_expiry"`
|
|
}
|
|
|
|
type UniqueIDConfig struct {
|
|
DataCenterID uint16 `mapstructure:"datacenter_id"`
|
|
WorkerID uint16 `mapstructure:"worker_id"`
|
|
}
|