runtimesConfigToMap converts RuntimesConfig back to map[string]any
(config *RuntimesConfig)
| 272 | |
| 273 | // runtimesConfigToMap converts RuntimesConfig back to map[string]any |
| 274 | func runtimesConfigToMap(config *RuntimesConfig) map[string]any { |
| 275 | if config == nil { |
| 276 | return nil |
| 277 | } |
| 278 | frontmatterTypesLog.Printf("Converting RuntimesConfig to map: %d runtime(s) configured", countRuntimes(config)) |
| 279 | |
| 280 | result := make(map[string]any) |
| 281 | |
| 282 | runtimes := []struct { |
| 283 | key string |
| 284 | rc *RuntimeConfig |
| 285 | }{ |
| 286 | {"node", config.Node}, |
| 287 | {"python", config.Python}, |
| 288 | {"go", config.Go}, |
| 289 | {"uv", config.UV}, |
| 290 | {"bun", config.Bun}, |
| 291 | {"deno", config.Deno}, |
| 292 | {"dotnet", config.Dotnet}, |
| 293 | {"elixir", config.Elixir}, |
| 294 | {"gh-aw", config.GhAw}, |
| 295 | {"haskell", config.Haskell}, |
| 296 | {"java", config.Java}, |
| 297 | {"ruby", config.Ruby}, |
| 298 | } |
| 299 | for _, r := range runtimes { |
| 300 | if r.rc != nil { |
| 301 | if m := runtimeConfigToMap(r.rc); len(m) > 0 { |
| 302 | result[r.key] = m |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | if len(result) == 0 { |
| 308 | return nil |
| 309 | } |
| 310 | |
| 311 | return result |
| 312 | } |
| 313 | |
| 314 | // permissionsConfigToMap converts PermissionsConfig back to map[string]any |
| 315 | func permissionsConfigToMap(config *PermissionsConfig) map[string]any { |