Skip to content

Commit e128b05

Browse files
authored
Merge pull request #48 from blockopsnetwork/fix/slack-config-path
sync slack team_id and log config path
2 parents 2d14982 + a75eeba commit e128b05

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

cmd/bot.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ func (b *Bot) buildPonosConfigPayload() map[string]any {
747747
"signing_key": b.config.Integrations.Slack.SigningKey,
748748
"verify_token": b.config.Integrations.Slack.VerifyToken,
749749
"channel": b.config.Integrations.Slack.Channel,
750+
"team_id": b.config.Integrations.Slack.TeamID,
750751
},
751752
"telescope": map[string]any{
752753
"project_id": b.config.Integrations.Telescope.ProjectID,
@@ -798,6 +799,13 @@ func (b *Bot) trySyncConfig(ctx context.Context) error {
798799
b.logger.Warn("Failed to reload ponos config before sync", "error", err)
799800
}
800801

802+
b.logger.Info(
803+
"Syncing ponos config to agent-core",
804+
"config_path", b.config.ConfigPath,
805+
"diagnostics_owner", b.config.Diagnostics.GitHub.Owner,
806+
"diagnostics_repo", b.config.Diagnostics.GitHub.Repo,
807+
)
808+
801809
requestData := map[string]any{
802810
"message": "Configuration sync",
803811
"ponos_config": b.buildPonosConfigPayload(),

config/config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Config struct {
1616
Diagnostics DiagnosticsConfig `yaml:"diagnostics"`
1717
Server ServerConfig `yaml:"server"`
1818
Projects []Project `yaml:"projects"`
19+
ConfigPath string `yaml:"-" json:"-"`
1920
}
2021

2122
type IntegrationsConfig struct {
@@ -49,6 +50,7 @@ type SlackConfig struct {
4950
SigningKey string `envconfig:"SLACK_SIGNING_SECRET" default:"" yaml:"signing_key"`
5051
VerifyToken string `envconfig:"SLACK_VERIFICATION_TOKEN" default:"" yaml:"verify_token"`
5152
Channel string `envconfig:"SLACK_CHANNEL" default:"sre-tasks" yaml:"channel"`
53+
TeamID string `envconfig:"SLACK_TEAM_ID" default:"" yaml:"team_id"`
5254
}
5355

5456
type DiagnosticsConfig struct {
@@ -128,7 +130,7 @@ func Load() (*Config, error) {
128130
if err := yaml.Unmarshal(data, &cfg); err != nil {
129131
return nil, fmt.Errorf("invalid ponos.yml format: %w", err)
130132
}
131-
133+
cfg.ConfigPath = configPath
132134
cfg.Sanitize()
133135
return &cfg, nil
134136
}
@@ -145,6 +147,7 @@ func (c *Config) Sanitize() {
145147
c.Integrations.Slack.SigningKey = strings.TrimSpace(c.Integrations.Slack.SigningKey)
146148
c.Integrations.Slack.Channel = strings.TrimSpace(c.Integrations.Slack.Channel)
147149
c.Integrations.Slack.VerifyToken = strings.TrimSpace(c.Integrations.Slack.VerifyToken)
150+
c.Integrations.Slack.TeamID = strings.TrimSpace(c.Integrations.Slack.TeamID)
148151

149152
c.APIEndpoint = strings.TrimSpace(c.APIEndpoint)
150153
c.APIKey = strings.TrimSpace(c.APIKey)

0 commit comments

Comments
 (0)