Skip to content

Refactor config interpolation in gateway#2761

Draft
thivindu wants to merge 3 commits into
wso2:mainfrom
thivindu:config-interpolation
Draft

Refactor config interpolation in gateway#2761
thivindu wants to merge 3 commits into
wso2:mainfrom
thivindu:config-interpolation

Conversation

@thivindu

@thivindu thivindu commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 54c423a2-39e3-4949-90cb-49bb26d523f5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Gateway configuration now uses explicit {{ env }} and {{ file }} interpolation instead of automatic APIP_GW_ overrides. Controller, policy-engine, compose, templates, integration configs, tests, and documentation were updated accordingly.

Changes

Gateway configuration interpolation

Layer / File(s) Summary
Controller configuration loading
gateway/gateway-controller/pkg/config/*, gateway/gateway-controller/go.mod
Controller loading now applies file values over defaults, resolves interpolation tokens, removes automatic environment mapping, and tests both token resolution and non-override behavior.
Policy-engine configuration loading
gateway/gateway-runtime/policy-engine/internal/config/*, gateway/gateway-runtime/policy-engine/go.mod
Policy-engine loading and tests now use explicit interpolation tokens instead of the removed environment provider.
Configuration templates and runtime wiring
gateway/configs/*, gateway/docker-compose*.yaml, gateway/distribution/*, gateway/gateway-builder/*, gateway/it/*, gateway/.gitignore
Configuration templates, compose services, controller image defaults, integration fixtures, and local secret-file handling were updated for token-based environment values.
Configuration guidance updates
.agents/skills/gateway-debug/*, docs/gateway/*, gateway/*README.md, gateway/DEBUG_GUIDE.md
Gateway configuration, debugging, deployment, immutable-mode, and runtime documentation now describes interpolation-based settings and corrected variable names.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Compose
  participant ConfigFile
  participant GatewayController
  participant Environment
  Compose->>GatewayController: start with api-platform.env
  GatewayController->>ConfigFile: load config.toml over defaults
  ConfigFile->>Environment: resolve {{ env }} tokens
  Environment-->>GatewayController: interpolated settings
  GatewayController->>GatewayController: unmarshal and validate
Loading

Possibly related PRs

  • wso2/api-platform#2580: Overlaps the gateway-controller and policy-engine configuration validation and loading paths.

Suggested reviewers: renuka-fernando, malinthaprasan, ashera96

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete and only states Pending plus one related issue link, missing most required template sections. Fill in Purpose, Goals, Approach, User stories, Documentation, tests, security checks, Samples, Related PRs, and Test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: refactoring config interpolation in the gateway.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
gateway/configs/config-template.toml (1)

14-14: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider generating a unique gateway_id dynamically.

The default gateway_id is still the static "platform-gateway-id" placeholder. Based on learnings, when deploying multiple gateways against a shared database, ensure that deployment scripts or configurations dynamically generate and inject a unique ID (preferably UUIDv7) via the APIP_GW_CONTROLLER_SERVER_GATEWAY_ID environment variable to prevent identification collisions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@gateway/configs/config-template.toml` at line 14, Update the gateway_id
configuration in the template to require or generate a deployment-specific
unique identifier, preferably UUIDv7, through
APIP_GW_CONTROLLER_SERVER_GATEWAY_ID instead of falling back to the static
"platform-gateway-id" value. Ensure deployment scripts or configuration inputs
inject a distinct ID for each gateway instance.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gateway/configs/config.toml`:
- Around line 39-61: Add the missing [controller.storage.postgres] configuration
block to config.toml with explicit env interpolation tokens for its Postgres
settings, and add deployment_sync_enabled under [controller.controlplane] using
the corresponding environment override token and default. Preserve the existing
configuration structure and naming conventions so Docker Compose users can
configure Postgres and deployment sync through api-platform.env.

---

Nitpick comments:
In `@gateway/configs/config-template.toml`:
- Line 14: Update the gateway_id configuration in the template to require or
generate a deployment-specific unique identifier, preferably UUIDv7, through
APIP_GW_CONTROLLER_SERVER_GATEWAY_ID instead of falling back to the static
"platform-gateway-id" value. Ensure deployment scripts or configuration inputs
inject a distinct ID for each gateway instance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7f189a96-dd91-4fe6-a94e-a98395682ccf

📥 Commits

Reviewing files that changed from the base of the PR and between 995663e and 16ea1d8.

⛔ Files ignored due to path filters (2)
  • gateway/gateway-controller/go.sum is excluded by !**/*.sum
  • gateway/gateway-runtime/policy-engine/go.sum is excluded by !**/*.sum
📒 Files selected for processing (24)
  • .agents/skills/gateway-debug/SKILL.md
  • docs/gateway/bottom-up-api-deployment-guide.md
  • docs/gateway/immutable-gateway.md
  • gateway/.gitignore
  • gateway/DEBUG_GUIDE.md
  • gateway/README.md
  • gateway/configs/config-template.toml
  • gateway/configs/config.toml
  • gateway/distribution/docker-compose.yaml
  • gateway/docker-compose-perf.yaml
  • gateway/docker-compose.debug.yaml
  • gateway/docker-compose.yaml
  • gateway/gateway-builder/templates/Dockerfile.gateway-controller.tmpl
  • gateway/gateway-controller/README.md
  • gateway/gateway-controller/go.mod
  • gateway/gateway-controller/pkg/config/config.go
  • gateway/gateway-controller/pkg/config/config_test.go
  • gateway/gateway-runtime/README.md
  • gateway/gateway-runtime/policy-engine/go.mod
  • gateway/gateway-runtime/policy-engine/internal/config/config.go
  • gateway/gateway-runtime/policy-engine/internal/config/config_test.go
  • gateway/it/test-config.toml
  • gateway/it/test-config.vhosts-multi.toml
  • gateway/it/test-config.vhosts-single.toml
💤 Files with no reviewable changes (2)
  • gateway/gateway-runtime/policy-engine/go.mod
  • gateway/gateway-controller/go.mod

Comment thread gateway/configs/config.toml
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/envoyproxy/go-control-plane/envoy
Version: v1.36.0 (was v1.37.0)
Allowed range: >=v1.36.0
Approved: ✅ Yes

Dependency name: google.golang.org/grpc
Version: v1.79.3 (was v1.82.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.82.0]

Dependency name: github.com/gorilla/websocket
Version: v1.5.3 (was v1.5.4-0.20250319132907-e064f32e3674)
Allowed range: >=v1.5.3
Approved: ✅ Yes

Dependency name: github.com/testcontainers/testcontainers-go/modules/compose
Version: v0.40.0 (was v0.43.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v0.43.0]

Dependency name: github.com/envoyproxy/go-control-plane/envoy
Version: v1.36.0 (was v1.37.0)
Allowed range: >=v1.36.0
Approved: ✅ Yes

Dependency name: go.opentelemetry.io/otel
Version: v1.41.0 (was v1.44.0)
Allowed range: >=v1.39.0
Approved: ✅ Yes

Dependency name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
Version: v1.41.0 (was v1.44.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.44.0]

Dependency name: go.opentelemetry.io/otel/sdk
Version: v1.41.0 (was v1.44.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.44.0]

Dependency name: go.opentelemetry.io/otel/trace
Version: v1.41.0 (was v1.44.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.44.0]

Dependency name: go.opentelemetry.io/proto/otlp
Version: v1.9.0 (was v1.10.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.10.0]

Dependency name: google.golang.org/grpc
Version: v1.79.3 (was v1.82.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.82.0]

Dependency name: github.com/testcontainers/testcontainers-go/modules/compose
Version: v0.40.0 (was v0.43.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v0.43.0]


Next Steps

  1. Review the validation failures listed above
  2. Check if dependencies are in the approved dependency list
  3. Options to resolve:
    • Remove the unapproved dependencies from this PR
    • OR submit a PR to add these dependencies to the approved list in engineering-governance
  4. Once resolved, push changes to re-run validation

This PR is blocked until all dependencies are approved.

⚠️ Please verify the scope of the dependencies usage is necessary

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/envoyproxy/go-control-plane/envoy
Version: v1.36.0 (was v1.37.0)
Allowed range: >=v1.36.0
Approved: ✅ Yes

Dependency name: google.golang.org/grpc
Version: v1.79.3 (was v1.82.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.82.0]

Dependency name: github.com/gorilla/websocket
Version: v1.5.3 (was v1.5.4-0.20250319132907-e064f32e3674)
Allowed range: >=v1.5.3
Approved: ✅ Yes

Dependency name: github.com/testcontainers/testcontainers-go/modules/compose
Version: v0.40.0 (was v0.43.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v0.43.0]

Dependency name: github.com/envoyproxy/go-control-plane/envoy
Version: v1.36.0 (was v1.37.0)
Allowed range: >=v1.36.0
Approved: ✅ Yes

Dependency name: go.opentelemetry.io/otel
Version: v1.41.0 (was v1.44.0)
Allowed range: >=v1.39.0
Approved: ✅ Yes

Dependency name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
Version: v1.41.0 (was v1.44.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.44.0]

Dependency name: go.opentelemetry.io/otel/sdk
Version: v1.41.0 (was v1.44.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.44.0]

Dependency name: go.opentelemetry.io/otel/trace
Version: v1.41.0 (was v1.44.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.44.0]

Dependency name: go.opentelemetry.io/proto/otlp
Version: v1.9.0 (was v1.10.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.10.0]

Dependency name: google.golang.org/grpc
Version: v1.79.3 (was v1.82.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v1.82.0]

Dependency name: github.com/testcontainers/testcontainers-go/modules/compose
Version: v0.40.0 (was v0.43.0)
Approved: ❌ No - Version constraint not met - approved versions: [>=v0.43.0]


Next Steps

  1. Review the validation failures listed above
  2. Check if dependencies are in the approved dependency list
  3. Options to resolve:
    • Remove the unapproved dependencies from this PR
    • OR submit a PR to add these dependencies to the approved list in engineering-governance
  4. Once resolved, push changes to re-run validation

This PR is blocked until all dependencies are approved.

⚠️ Please verify the scope of the dependencies usage is necessary

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant