summaryrefslogtreecommitdiff
path: root/internal/config/config_test.go
diff options
context:
space:
mode:
authorChia <Chia@93.nz>2026-08-05 22:01:29 +1200
committerChia <Chia@93.nz>2026-08-05 22:07:50 +1200
commiteadb2ffe85c43cf6fc741c9823cd28eedb4a844c (patch)
tree1aba2536d57360da403aa35c9ced58b615c7064e /internal/config/config_test.go
parentcd0dd91ab93653631904f2ea0e574ccde6d60339 (diff)
feat: harden prepaid billing and commercial operations
Diffstat (limited to 'internal/config/config_test.go')
-rw-r--r--internal/config/config_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 1ecf70f..8e2e9bb 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -110,6 +110,8 @@ func TestLoadResolvesStripeSecrets(t *testing.T) {
t.Setenv("TEST_STRIPE_WEBHOOK", "whsec_example")
t.Setenv("TEST_STRIPE_SUCCESS", "https://console.example.test/admin/?topup=success")
t.Setenv("TEST_STRIPE_CANCEL", "https://console.example.test/admin/?topup=cancel")
+ t.Setenv("AIGW_STRIPE_PORTAL_RETURN_URL", "https://console.example.test/admin/?billing=portal")
+ t.Setenv("AIGW_SETTLEMENT_SPOOL_PATH", filepath.Join(t.TempDir(), "settlements.jsonl"))
path := writeConfig(t, `{
"control_plane":{"enabled":true},
"billing":{"enabled":true,"stripe":{"enabled":true,"api_key_env":"TEST_STRIPE_KEY","webhook_secret_env":"TEST_STRIPE_WEBHOOK","success_url_env":"TEST_STRIPE_SUCCESS","cancel_url_env":"TEST_STRIPE_CANCEL"}}
@@ -147,6 +149,10 @@ func TestLoadRejectsBillingWithoutControlPlane(t *testing.T) {
func TestVersionedExamplesResolveExternalServicesFromEnvironment(t *testing.T) {
t.Setenv("AIGW_SERVER_ADDRESS", "127.0.0.1:18081")
+ t.Setenv("AIGW_PUBLIC_ADDRESS", "127.0.0.1:18081")
+ t.Setenv("AIGW_ADMIN_ADDRESS", "127.0.0.1:18082")
+ t.Setenv("AIGW_WEBHOOK_ADDRESS", "127.0.0.1:18083")
+ t.Setenv("AIGW_OPERATIONS_ADDRESS", "127.0.0.1:19090")
t.Setenv("AIGW_API_KEYS", `[{"key":"test","key_id":"key","tenant_id":"tenant","project_id":"project","scopes":["inference"]}]`)
t.Setenv("OPENAI_BASE_URL", "https://openai.example.test/v1")
t.Setenv("OPENAI_API_KEY", "openai-secret")
@@ -175,6 +181,8 @@ func TestVersionedExamplesResolveExternalServicesFromEnvironment(t *testing.T) {
t.Setenv("AIGW_STRIPE_WEBHOOK_SECRET", "whsec_example")
t.Setenv("AIGW_STRIPE_SUCCESS_URL", "https://console.example.test/admin/?topup=success")
t.Setenv("AIGW_STRIPE_CANCEL_URL", "https://console.example.test/admin/?topup=cancel")
+ t.Setenv("AIGW_STRIPE_PORTAL_RETURN_URL", "https://console.example.test/admin/?billing=portal")
+ t.Setenv("AIGW_SETTLEMENT_SPOOL_PATH", filepath.Join(t.TempDir(), "settlements.jsonl"))
controlConfig, err := Load(filepath.Join("..", "..", "config.control.example.json"))
if err != nil {
t.Fatalf("load control-plane example: %v", err)