Skip to content

Commit dff22d0

Browse files
committed
add roles to coordinator config
1 parent 6ff9304 commit dff22d0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cmd/coordinator/main.go

+11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ var rootCmd = &cobra.Command{
3939
}
4040
log.Println("Running config:", cfgStr)
4141

42+
if config.CoordinatorConfig().EnableRoleSystem {
43+
if config.CoordinatorConfig().RolesFile == "" {
44+
return fmt.Errorf("role system enabled but no roles file specified, see `enable_role_system` and `roles_file` in config")
45+
}
46+
rolesCfgStr, err := config.LoadRolesCfg(config.CoordinatorConfig().RolesFile)
47+
if err != nil {
48+
return err
49+
}
50+
log.Println("Running roles config:", rolesCfgStr)
51+
}
52+
4253
if logLevel != "" {
4354
config.CoordinatorConfig().LogLevel = logLevel
4455
}

pkg/config/coordinator.go

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type Coordinator struct {
2626
UseSystemdNotifier bool `json:"use_systemd_notifier" toml:"use_systemd_notifier" yaml:"use_systemd_notifier"`
2727
SystemdNotifierDebug bool `json:"systemd_notifier_debug" toml:"systemd_notifier_debug" yaml:"systemd_notifier_debug"`
2828
IterationTimeout time.Duration `json:"iteration_timeout" toml:"iteration_timeout" yaml:"iteration_timeout"`
29+
EnableRoleSystem bool `json:"enable_role_system" toml:"enable_role_system" yaml:"enable_role_system"`
30+
RolesFile string `json:"roles_file" toml:"roles_file" yaml:"roles_file"`
2931
}
3032

3133
// LoadCoordinatorCfg loads the coordinator configuration from the specified file path.

0 commit comments

Comments
 (0)