Skip to content

feat(config): unify region/domain/internal settings#4

Open
vaaandark wants to merge 3 commits intoTencentCloudAgentRuntime:mainfrom
vaaandark:main
Open

feat(config): unify region/domain/internal settings#4
vaaandark wants to merge 3 commits intoTencentCloudAgentRuntime:mainfrom
vaaandark:main

Conversation

@vaaandark
Copy link
Member

Unify region/domain/internal settings

Summary

Consolidate duplicated region, domain, and internal configuration fields from backend-specific [e2b] / [cloud] sections into unified top-level fields, reducing configuration complexity and ensuring consistent endpoint construction across all backends.

Motivation

Previously, users had to set e2b.region, e2b.domain, cloud.region, and cloud.internal separately under each backend section, even though these values were almost always identical. This PR introduces top-level region, domain, and internal fields as the single source of truth.

Changes

Config & CLI

  • Add top-level region, domain, internal config fields with corresponding --region, --domain, --internal CLI flags and AGS_REGION, AGS_DOMAIN, AGS_INTERNAL env vars
  • Deprecate --e2b-region, --e2b-domain, --cloud-region, --cloud-internal flags (with deprecation warnings)
  • Add resolveDeprecatedFields() to migrate legacy fields with clear priority: top-level > current-backend legacy > cross-backend fallback > default
  • Normalize internal flag into domain at config resolution time (internal=truedomain = "internal." + domain), so downstream code only reads domain
  • Use viper.IsSet("internal") to distinguish explicit internal=false from the default zero value

Client Layer

  • All data-plane and control-plane clients now read from unified config.GetRegion() / config.GetDomain() instead of backend-specific accessors

Docs & Config

  • Add docs/ags-config.md / docs/ags-config-zh.md — dedicated configuration reference
  • Update config.example.toml with unified fields and deprecation notes
  • Update CLI docs (ags.md, ags-zh.md) with new flags

Tests

  • Add 31 unit tests covering resolveDeprecatedFields, setter functions, endpoint construction, and validation (all priority/branch combinations from the review checklist)

Backward Compatibility

All deprecated fields and flags remain functional with automatic migration. A deprecation warning is printed to stderr when legacy fields are used. No breaking changes.

@vaaandark vaaandark requested review from keithfx999 and wswcfan March 4, 2026 09:40
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