refactor: 重构集群主从节点模式
This commit is contained in:
@@ -70,6 +70,7 @@ func (m *Manager) ReloadConfig() error {
|
||||
|
||||
config := &Config{
|
||||
Server: types.ServerConfig{
|
||||
IsMaster: !utils.ParseBoolean(os.Getenv("IS_SLAVE"), true),
|
||||
Port: utils.ParseInteger(os.Getenv("PORT"), 3001),
|
||||
Host: utils.GetEnvOrDefault("HOST", "0.0.0.0"),
|
||||
ReadTimeout: utils.ParseInteger(os.Getenv("SERVER_READ_TIMEOUT"), 120),
|
||||
@@ -111,6 +112,11 @@ func (m *Manager) ReloadConfig() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsMaster returns Server mode
|
||||
func (m *Manager) IsMaster() bool {
|
||||
return m.config.Server.IsMaster
|
||||
}
|
||||
|
||||
// GetAuthConfig returns authentication configuration
|
||||
func (m *Manager) GetAuthConfig() types.AuthConfig {
|
||||
return m.config.Auth
|
||||
|
Reference in New Issue
Block a user