buildAWFConfigSchemaURL returns the release-pinned JSON schema URL for the AWF config file. The URL is versioned so that schema validation tools always reference the exact schema that matches the AWF binary being used. When DefaultFirewallVersion is bumped the URL automatically tracks the new releas
(firewallConfig *FirewallConfig)
| 354 | // If firewallConfig carries an explicit version (e.g. sandbox.agent.version) that version |
| 355 | // is used; otherwise DefaultFirewallVersion is used. |
| 356 | func buildAWFConfigSchemaURL(firewallConfig *FirewallConfig) string { |
| 357 | version := string(constants.DefaultFirewallVersion) |
| 358 | if firewallConfig != nil && firewallConfig.Version != "" { |
| 359 | version = firewallConfig.Version |
| 360 | } |
| 361 | // Special-case "latest": the GitHub Releases /latest/download/ shortcut serves |
| 362 | // assets from the most recent release without requiring a tag in the path. |
| 363 | if strings.EqualFold(version, "latest") { |
| 364 | return "https://github.com/github/gh-aw-firewall/releases/latest/download/awf-config.schema.json" |
| 365 | } |
| 366 | // Ensure version has the 'v' prefix required by GitHub release tag URLs. |
| 367 | if !strings.HasPrefix(version, "v") { |
| 368 | version = "v" + version |
| 369 | } |
| 370 | return fmt.Sprintf("https://github.com/github/gh-aw-firewall/releases/download/%s/awf-config.schema.json", version) |
| 371 | } |
| 372 | |
| 373 | // BuildAWFConfigJSON generates a compact JSON config file for AWF from the provided |
| 374 | // command configuration. The JSON is single-line (no indentation) for safe embedding |
no outgoing calls