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
// 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
}
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.