extractRunnerConfig extracts runner topology configuration from frontmatter. Returns nil when no runner configuration is present.
(frontmatter map[string]any)
| 11 | // extractRunnerConfig extracts runner topology configuration from frontmatter. |
| 12 | // Returns nil when no runner configuration is present. |
| 13 | func extractRunnerConfig(frontmatter map[string]any) *RunnerConfig { |
| 14 | runner, exists := frontmatter["runner"] |
| 15 | if !exists { |
| 16 | return nil |
| 17 | } |
| 18 | |
| 19 | runnerObj, ok := runner.(map[string]any) |
| 20 | if !ok { |
| 21 | runnerConfigLog.Printf("runner field has unexpected type %T, expected object", runner) |
| 22 | return nil |
| 23 | } |
| 24 | |
| 25 | config := &RunnerConfig{} |
| 26 | if topology, ok := runnerObj["topology"].(string); ok { |
| 27 | config.Topology = topology |
| 28 | runnerConfigLog.Printf("Runner topology: %s", topology) |
| 29 | } |
| 30 | |
| 31 | if config.Topology == "" { |
| 32 | return nil |
| 33 | } |
| 34 | |
| 35 | return config |
| 36 | } |
| 37 | |
| 38 | // validateRunnerConfig validates the runner topology configuration. |
| 39 | // It returns an error if the topology value is not recognized. |