.
This commit is contained in:
@@ -50,12 +50,12 @@ type AOIConfig struct {
|
||||
}
|
||||
|
||||
type NetworkConfig struct {
|
||||
WriteBufferSize int `yaml:"write_buffer_size"`
|
||||
ReadBufferSize int `yaml:"read_buffer_size"`
|
||||
SendChannelSize int `yaml:"send_channel_size"`
|
||||
WriteBufferSize int `yaml:"write_buffer_size"`
|
||||
ReadBufferSize int `yaml:"read_buffer_size"`
|
||||
SendChannelSize int `yaml:"send_channel_size"`
|
||||
HeartbeatInterval time.Duration `yaml:"heartbeat_interval"`
|
||||
HeartbeatTimeout time.Duration `yaml:"heartbeat_timeout"`
|
||||
MaxMessageSize int64 `yaml:"max_message_size"`
|
||||
MaxMessageSize int64 `yaml:"max_message_size"`
|
||||
}
|
||||
|
||||
type LogConfig struct {
|
||||
@@ -81,6 +81,23 @@ func Load(path string) (*Config, error) {
|
||||
return nil, fmt.Errorf("parse config file: %w", err)
|
||||
}
|
||||
|
||||
// 환경변수로 DB 접속 정보 오버라이드 (Docker 환경용)
|
||||
if v := os.Getenv("DB_HOST"); v != "" {
|
||||
cfg.Database.Host = v
|
||||
}
|
||||
if v := os.Getenv("DB_PORT"); v != "" {
|
||||
fmt.Sscanf(v, "%d", &cfg.Database.Port)
|
||||
}
|
||||
if v := os.Getenv("DB_USER"); v != "" {
|
||||
cfg.Database.User = v
|
||||
}
|
||||
if v := os.Getenv("DB_PASSWORD"); v != "" {
|
||||
cfg.Database.Password = v
|
||||
}
|
||||
if v := os.Getenv("DB_NAME"); v != "" {
|
||||
cfg.Database.DBName = v
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user