Documentation
¶
Overview ¶
Package config holds the wsproxy runtime configuration. All env-var defaults and flag registrations are centralised here so the rest of the codebase is free of os.Getenv calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// ListenAddr is the address the terminal WebSocket proxy listens on.
// Flag: --listen-addr Env: WSPROXY_LISTEN_ADDR Default: :9003
ListenAddr string
// InternalAddr is the address the internal management API listens on.
// Only used when SyncToken is non-empty.
// Flag: --internal-addr Env: WSPROXY_INTERNAL_ADDR Default: :9004
InternalAddr string
// ClustersFilePath is the path to clusters.yaml consumed by cluster.Store.
// Flag: --clusters-config Env: CLUSTERS_CONFIG_PATH
ClustersFilePath string
// Secret is the single shared secret used for:
// - dialling Worker /v1/ws/sync endpoints (AGENTBOX-SYNC-TOKEN header);
// - gating the legacy /internal/* routes (static token check);
// - verifying Bearer JWTs issued by the BFF (HS256).
// When empty the sync manager is disabled and JWT auth is off.
// Flag: --secret Env: AGENTBOX_SECRET
Secret string
// AdminKey is the shared admin API key used by the internal API auth
// middleware to recognise admin callers via AGENTBOX-API-KEY header.
// When empty the internal API runs in dev mode (anonymous admin).
// Flag: --admin-key Env: AGENTBOX_ADMIN_KEY
AdminKey string
// ConsoleBaseURL is this deployment's own public address, e.g.
// "https://console.example.com/agentbox". Republished to every Worker on
// the cluster-config snapshot so a Worker refusing a write can name the page
// a person opens to approve it. Configured here because the hub IS the
// console and is the only party that knows its own address.
ConsoleBaseURL string
// MaxKeysPerUser is the per-(namespace, user) API key count limit.
// 0 means unlimited.
// Flag: --max-keys-per-user Env: AGENTBOX_MAX_KEYS_PER_USER
MaxKeysPerUser int
// APIKeyNamespace is the Kubernetes namespace where API key Secrets are stored.
// Flag: --apikey-namespace Env: AGENTBOX_APIKEY_NAMESPACE Default: agentbox-system
APIKeyNamespace string
// ImagesCatalogConfigMap is the name of the ConfigMap that holds the images
// catalog. It is stored in APIKeyNamespace.
// Flag: --images-catalog-configmap Env: AGENTBOX_IMAGES_CATALOG_CONFIGMAP
// Default: agentbox-images-catalog
ImagesCatalogConfigMap string
// NotificationConfigMap is the name of the ConfigMap that holds the
// notification service's config + runtime state. Stored in APIKeyNamespace.
// Flag: --notification-configmap Env: AGENTBOX_NOTIFICATION_CONFIGMAP
// Default: agentbox-notifications
NotificationConfigMap string
// FeishuWebhookURL is the Feishu (Lark) bot webhook the notification
// service posts daily reports and idle alerts to. Empty disables sending.
// Flag: --feishu-webhook-url Env: FEISHU_WEBHOOK_URL
FeishuWebhookURL string
// PrometheusURL is the base query URL of the Prometheus-compatible metrics
// store the notification service reads sandbox-create counters from.
// Empty disables the daily report and idle alert (no data source).
// Flag: --prometheus-url Env: PROMETHEUS_URL
PrometheusURL string
// PrometheusToken is the bearer token sent with every PrometheusURL query.
// Flag: --prometheus-token Env: PROMETHEUS_TOKEN
PrometheusToken string
}
Config holds all wsproxy runtime settings. Each field maps 1:1 to a CLI flag whose default value is the matching environment variable (or a hard-coded default when the env var is absent).
func FromFlags ¶
FromFlags registers all wsproxy flags on fs and returns a *Config whose fields point to the registered flag values. Call flag.Parse() (or fs.Parse()) after this to populate the fields.
Each flag's default is the corresponding environment variable, falling back to the built-in default when the env var is absent.
func (*Config) SyncEnabled ¶
SyncEnabled reports whether the sync manager (and internal API) should be started. It is true when Secret is non-empty.