[ PROMPT_NODE_23978 ]
Argo Smart Routing 配置说明
[ SKILL_DOCUMENTATION ]
## 配置管理
**关于 Smart Shield 演进的说明:** Argo 智能路由正在集成到 Smart Shield 中。以下配置方法仍然有效;Terraform 和 IaC 模式保持不变。
### 基础设施即代码 (Terraform)
hcl
# terraform/argo.tf
# 注意:使用 Cloudflare Terraform 提供程序
resource "cloudflare_argo" "example" {
zone_id = var.zone_id
smart_routing = "on"
tiered_caching = "on"
}
variable "zone_id" {
description = "Cloudflare 域名 ID"
type = string
}
output "argo_enabled" {
value = cloudflare_argo.example.smart_routing
description = "Argo 智能路由状态"
}
### 基于环境的配置
typescript
// config/argo.ts
interface ArgoEnvironmentConfig {
enabled: boolean;
tieredCache: boolean;
monitoring: {
usageAlerts: boolean;
threshold: number;
};
}
const configs: Record = {
production: {
enabled: true,
tieredCache: true,
monitoring: {
usageAlerts: true,
threshold: 1000, // GB
},
},
staging: {
enabled: true,
tieredCache: false,
monitoring: {
usageAlerts: false,
threshold: 100, // GB
},
},
development: {
enabled: false,
tieredCache: false,
monitoring: {
usageAlerts: false,
threshold: 0,
},
},
};
export function getArgoConfig(env: string): ArgoEnvironmentConfig {
return configs[env] || configs.development;
}
### Pulumi 配置
typescript
// pulumi/argo.ts
import * as cloudflare from '@pulumi/cloudflare';
const zone = new cloudflare.Zone('example-zone', {
zone: 'example.com',
plan: 'enterprise',
});
const argoSettings = new cloudflare.Argo('argo-config', {
zoneId: zone.id,
smartRouting: 'on',
tieredCaching: 'on',
});
export const argoEnabled = argoSettings.smartRouting;
export const zoneId = zone.id;
## 计费配置
在启用 Argo 智能路由之前,请确保账户已配置计费信息:
**先决条件:**
1. 存档有有效的支付方式
2. 企业版或更高计划
3. 域名必须已启用计费
**通过仪表板检查计费状态:**
1. 导航至 Account → Billing
2. 验证支付方式是否已配置
3. 检查域名订阅状态
**注意:** 如果在未配置计费的情况下尝试启用 Argo,API 响应中将显示 `editable: false`。
## 环境变量设置
**所需环境变量:**
bash
# .env
CLOUDFLARE_API_TOKEN=your_api_token_her