config

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AuthModeDev = "dev"

AuthModeDev is the development auth mode name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// StoreURI selects the backing store via a URI scheme. Examples:
	//   sqlite:/tmp/aibrix-console.db                   (file-backed, dev default)
	//   sqlite:/var/lib/aibrix/console.db               (file-backed, absolute)
	//   sqlite::memory:                                 (in-memory SQLite)
	//   memory://                                       (alias for in-memory SQLite)
	//   mysql://user:pass@host:3306/aibrix              (production)
	// Future: postgres://, redis://, mongodb:// — add a case in store.NewFromURI.
	StoreURI string

	// GatewayEndpoint is the AIBrix gateway URL for proxying inference requests.
	GatewayEndpoint string
	// MetadataServiceURL is the metadata service URL for file proxy operations.
	MetadataServiceURL string
	// MetadataFileUploadTimeout bounds file uploads proxied to metadata service.
	MetadataFileUploadTimeout time.Duration
	// DefaultBatchModelDeploymentTemplate is injected as aibrix.model_template
	// on CreateJob requests when the caller does not provide one. Temporary
	// stop-gap until the Model entity carries a per-model batch_template.
	DefaultBatchModelDeploymentTemplate string
	// Provisioner selects which RM provisioner backend the planner should
	// use at runtime. Forwarded to resource_manager.NewResourceManager
	// which validates against the supported set defined in
	// resource_manager/types.ResourceProvisionType*
	Provisioner string
	// PlanningPolicy is the policy type to use for the planner.
	PlanningPolicy string
	// PlannerWorkerCount is the number of worker threads to use for the planner.
	// Defaults to 10.
	PlannerWorkerCount int
	// PlannerWorkerQueueSize bounds queued planner work without blocking the
	// planning loop. Defaults to 1000.
	PlannerWorkerQueueSize int

	// GRPCAddr is the listen address for the gRPC server.
	GRPCAddr string
	// HTTPAddr is the listen address for the HTTP gateway.
	HTTPAddr string

	// AuthMode controls authentication: "dev", "oidc", or "basic".
	AuthMode string
	// OIDCIssuerURL is the OIDC provider issuer URL.
	OIDCIssuerURL string
	// OIDCClientID is the OIDC client identifier.
	OIDCClientID string
	// OIDCClientSecret is the OIDC client secret.
	OIDCClientSecret string
	// OIDCRedirectURL is the OIDC redirect URL after authentication.
	OIDCRedirectURL string
	// OIDCPostLogoutRedirectURL is the URL the OIDC provider should send
	// the browser to after end-session is complete. Must be registered as
	// a post-logout redirect URI in the SSO console.
	OIDCPostLogoutRedirectURL string
	// OIDCEndSessionURL is a fallback for the provider's end-session
	// endpoint when it isn't advertised in the discovery document. Set
	// it explicitly (e.g. https://${sso}/oidc/v1/logout) to enable
	// RP-initiated logout against IdPs that don't publish the URL.
	OIDCEndSessionURL string
	// OIDCGroupsClaim is the ID-token claim name that carries the user's
	// group memberships (string array). Defaults to "groups".
	OIDCGroupsClaim string
	// OIDCAdminGroups is a comma-separated list of group names that map
	// to the "admin" role. Users not in any of these groups receive the
	// "viewer" role. Empty means every authenticated user is "viewer".
	OIDCAdminGroups string
	// OIDCAdminEmails is a comma-separated list of email addresses that
	// map to the "admin" role regardless of group membership. Useful for
	// IdPs whose ID tokens don't carry a groups claim (e.g. our internal
	// SSO) — operators can still grant admin without per-user IdP changes.
	OIDCAdminEmails string
	// OIDCSigningAlg overrides the ID-token signing algorithm. Defaults to
	// RS256 (verified via the provider's JWKS). Set to "HS256" for IdPs
	// that sign ID tokens with the client_secret as a shared HMAC key —
	// at the time of writing, the company SSO documents this as the only
	// supported algorithm for its default Authorization Server.
	OIDCSigningAlg string

	// SessionSecret is used to sign session cookies. Must be provided via
	// SESSION_SECRET env var in non-dev modes; generated randomly in dev mode.
	SessionSecret string

	// SecretsEncryptionKey is the 32-byte hex-encoded AES-256 key used to
	// encrypt stored secret values. Must be provided via SECRETS_ENCRYPTION_KEY
	// env var in non-dev modes; generated randomly in dev mode.
	SecretsEncryptionKey string

	// DevUserName is the display name used in dev auth mode.
	DevUserName string
	// DevUserEmail is the email address used in dev auth mode.
	DevUserEmail string

	// BasicUsername is the username for basic auth mode.
	BasicUsername string
	// BasicPassword is the password for basic auth mode.
	BasicPassword string

	// StaticFilesDir is the path to the frontend dist/ directory.
	// When empty, static file serving is disabled.
	StaticFilesDir string

	// AllowedOrigins is a comma-separated list of allowed CORS origins.
	// When empty, CORS is disabled (same-origin only).
	AllowedOrigins string

	// DevMode toggles development conveniences. Currently it controls demo-data
	// seeding on startup; future dev-only behaviors should hang off the same
	// flag so a single switch covers the "I'm running this locally" intent.
	DevMode bool

	// ErrorInjectionEnabled controls whether error injection is enabled.
	ErrorInjectionEnabled bool

	// Metrics holds the metrics configuration.
	// When nil, no metrics backends are initialised and all emissions are no-ops.
	Metrics *MetricsConfig

	// KubernetesProvider configures access to the cluster used by the
	// "kubernetes" deployment provider.
	KubernetesProvider KubernetesProviderConfig
	// KubernetesWorkload configures default properties of resources rendered by
	// the "kubernetes" deployment provider.
	KubernetesWorkload KubernetesWorkloadConfig
}

Config holds all configuration for the AIBrix console backend.

func Load

func Load() (*Config, error)

Load reads configuration from environment variables and applies sensible defaults.

In dev auth mode, SessionSecret and SecretsEncryptionKey are generated randomly at startup if not supplied. In non-dev modes both must be provided explicitly via SESSION_SECRET and SECRETS_ENCRYPTION_KEY environment variables; Load returns an error otherwise.

type KubernetesProviderConfig added in v0.8.0

type KubernetesProviderConfig struct {
	Kubeconfig string
	Context    string
	Namespace  string
}

KubernetesProviderConfig identifies the cluster and namespace used by the Kubernetes deployment provider.

type KubernetesWorkloadConfig added in v0.8.0

type KubernetesWorkloadConfig struct {
	ServiceType             string
	ContainerPort           int32
	ServicePort             int32
	CPURequest              string
	HPATargetCPUUtilization int32
}

KubernetesWorkloadConfig holds defaults for Kubernetes resources rendered from a deployment template. These values are workload settings, not cluster connection settings.

type MetricsConfig added in v0.8.0

type MetricsConfig struct {
	// ServiceName is the metrics service identifier used as prefix.
	// Defaults to "aibrix-console".
	ServiceName string
	// DisableHostname suppresses the hostname from metric keys.
	DisableHostname bool

	// StatsDAddr is the address of a StatsD server.
	StatsDAddr string
	// StatsiteAddr is the address of a Statsite server.
	StatsiteAddr string
	// PrometheusEnabled enables the Prometheus metrics endpoint.
	PrometheusEnabled bool
	// PrometheusRetentionTime is how long Prometheus metrics are retained.
	// Defaults to 24h.
	PrometheusRetentionTime time.Duration

	// DogStatsDAddr is the address of a DogStatsD instance.
	DogStatsDAddr string
	// DogStatsDTags are global tags sent with each DogStatsD packet.
	DogStatsDTags []string

	*MetricsConfigExtension
}

MetricsConfig holds all configuration for the multi-backend metrics subsystem. Each backend is enabled by providing its address or required credentials; all enabled backends are composed into a fanout.

type MetricsConfigExtension added in v0.8.0

type MetricsConfigExtension struct {
}

Only used for extending the custom metrics backends. This SHOULD be left empty; all open-source backends should be placed in MetricsConfig directly.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL