Documentation
¶
Index ¶
- Constants
- Variables
- func ValidatePlatformRouting(runtime RuntimeMode, mode ComputeMode, platform *PlatformConfig) error
- func ValidateSharedComputeProvisioning(mode ComputeMode, cluster *ClusterConfig) error
- type ApplicationConfig
- func (c *ApplicationConfig) CustomDomainsEnabled() bool
- func (c *ApplicationConfig) ExternalPostgresImportEnabled() bool
- func (c *ApplicationConfig) IsStackdomeCloud() bool
- func (c *ApplicationConfig) LoadEnvVariables() error
- func (c *ApplicationConfig) LoadStackdomeCloudConfig() error
- func (c *ApplicationConfig) UsesSharedCompute() bool
- func (c *ApplicationConfig) Validate() error
- type ClusterConfig
- type ComputeMode
- type ConfigDuration
- type ConfigError
- type DBConnectionConfig
- type DatabaseConfig
- func (c *DatabaseConfig) ConnectionString() string
- func (c *DatabaseConfig) ConnectionStringWithName(name string, withSSL bool) string
- func (c *DatabaseConfig) LoadEnvVariables()
- func (c *DatabaseConfig) LogSafeConnectionString(withSSL bool) string
- func (c *DatabaseConfig) LogSafeConnectionStringWithName(name string, withSSL bool) string
- func (c *DatabaseConfig) Validate() error
- type EnvVar
- type GitHubAppConfig
- type GitHubOAuthConfig
- type PlatformConfig
- type RuntimeMode
- type SSLMode
- type ServerConfig
- type StackdomeCloudClientIPSource
- type StackdomeCloudComputeAccessConfig
- type StackdomeCloudConfig
- type StackdomeCloudEmailThrottleConfig
- type StackdomeCloudFeaturesConfig
- type StackdomeCloudIPThrottleConfig
- type StackdomeCloudRegistryConfig
- type StackdomeCloudSignupConfig
- type StackdomeCloudThrottleConfig
- type StackdomeCloudTurnstileConfig
Constants ¶
View Source
const ( EnvironmentTest = "test" EnvironmentDevelopment = "development" EnvironmentProduction = "production" )
View Source
const ( ACMEEnvironmentProduction = "production" ACMEEnvironmentStaging = "staging" DefaultPlatformTLSNamespace = "stackdome-control-plane" ACMEProductionDirectoryURL = "https://acme-v02.api.letsencrypt.org/directory" ACMEStagingDirectoryURL = "https://acme-staging-v02.api.letsencrypt.org/directory" )
Variables ¶
View Source
var ( // Application EnvJWTSecret = StringVar("JWT_SECRET", "JWT token signing secret", nil, true) EnvLogLevel = StringVar("LOG_LEVEL", "Logging level (debug, info, warn, error)", ptr("info"), false) EnvLogFormat = StringVar("LOG_FORMAT", "Log output format (json or text)", ptr("json"), false) EnvEncryptionKey = StringVar("ENCRYPTION_KEY", "Master encryption key (64-1024 chars)", nil, true) EnvRuntimeMode = StringVar("RUNTIME_MODE", "Runtime mode (self_hosted or stackdome_cloud)", ptr(string(RuntimeModeSelfHosted)), false) EnvComputeMode = StringVar("COMPUTE_MODE", "Compute mode (bring_your_own or shared)", ptr(string(ComputeModeBYOC)), false) EnvStackdomeCloudConfig = StringVar("STACKDOME_CLOUD_CONFIG", "Path to the Stackdome Cloud runtime configuration", nil, false) EnvTurnstileSecret = StringVar("TURNSTILE_SECRET", "Cloudflare Turnstile secret for signup verification", nil, false) // GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET are used for GitHub OAuth login EnvGitHubClientID = StringVar("GITHUB_CLIENT_ID", "GitHub OAuth app client ID", nil, false) EnvGitHubClientSecret = StringVar("GITHUB_CLIENT_SECRET", "GitHub OAuth app client secret", nil, false) EnvGitHubRedirectURI = StringVar("GITHUB_REDIRECT_URI", "GitHub OAuth app redirect URI (optional; derived from SERVER_EXTERNAL_URL when unset)", nil, false) // The GITHUB_APP_* vars configure one platform-wide GitHub App that every // org installs; unset leaves each org creating its own app via the // manifest flow. EnvGitHubAppID = IntVar("GITHUB_APP_ID", "Platform GitHub App numeric ID", nil, false) EnvGitHubAppSlug = StringVar("GITHUB_APP_SLUG", "Platform GitHub App URL slug", nil, false) EnvGitHubAppPrivateKey = StringVar("GITHUB_APP_PRIVATE_KEY", "Platform GitHub App private key (PEM)", nil, false) EnvGitHubAppWebhookSecret = StringVar("GITHUB_APP_WEBHOOK_SECRET", "Platform GitHub App webhook secret", nil, false) // Server EnvServerHostname = StringVar("SERVER_HOSTNAME", "Server hostname/domain", nil, false) EnvServerExternalURL = StringVar("SERVER_EXTERNAL_URL", "Externally reachable base URL of the hub (used for GitHub App callbacks and webhooks)", nil, false) // GitHub API base URL override (httptest stubs / GHES) EnvGitHubAPIBaseURL = StringVar("GITHUB_API_BASE_URL", "GitHub API base URL", ptr("https://api.github.com"), false) EnvServerBindAddress = StringVar("SERVER_BIND_ADDRESS", "Server bind address and port", ptr("0.0.0.0:8000"), false) EnvMetricsBindAddress = StringVar("METRICS_BIND_ADDRESS", "Internal Prometheus metrics bind address", ptr("0.0.0.0:9090"), false) // Database EnvDBHost = StringVar("DB_HOST", "PostgreSQL host", nil, true) EnvDBPort = IntVar("DB_PORT", "PostgreSQL port", nil, true) EnvDBName = StringVar("DB_NAME", "Database name", nil, true) EnvDBUsername = StringVar("DB_USERNAME", "Database user", nil, true) EnvDBPassword = StringVar("DB_PASSWORD", "Database password", nil, true) EnvDBSSLMode = StringVar("DB_SSL_MODE", "SSL mode (disable or require)", ptr("disable"), false) EnvDBMaxConnections = IntVar("DB_MAX_CONNECTIONS", "Max open DB connections", ptr(50), false) EnvDBRootCertFile = StringVar("DB_ROOT_CERT_FILE", "Root CA cert path for SSL", nil, false) EnvDBDebugMode = BoolVar("DB_DEBUG_MODE", "Enable DB query debug logging", ptr(false), false) // Shared Compute Cluster // Platform routing and TLS EnvPlatformEmail = StringVar("PLATFORM_EMAIL", "Operator contact email; ACME contact for the platform TLS issuer", nil, false) EnvPlatformBaseDomain = StringVar("PLATFORM_BASE_DOMAIN", "Base domain for the platform org and per-org subdomains", nil, false) EnvPlatformDNSCloudflareAPIToken = StringVar("PLATFORM_DNS_CLOUDFLARE_API_TOKEN", "Cloudflare API token used for platform wildcard DNS challenges", nil, false) EnvPlatformTLSEnabled = BoolVar("PLATFORM_TLS_ENABLED", "Enable platform-managed TLS on shared compute", ptr(false), false) EnvPlatformACMEEnvironment = StringVar("PLATFORM_ACME_ENVIRONMENT", "Let's Encrypt ACME environment (production or staging)", nil, false) EnvPlatformTLSNamespace = StringVar("PLATFORM_TLS_NAMESPACE", "Namespace for platform TLS resources", nil, false) EnvPlatformOrgRegistryStorageSize = StringVar("PLATFORM_ORG_REGISTRY_STORAGE_SIZE", "Default storage size for each org's registry seeded at signup", ptr(models.DefaultPlatformOrgRegistryStorageSize), false) EnvPlatformOrgRegistryStorageClass = StringVar("PLATFORM_ORG_REGISTRY_STORAGE_CLASS", "Default storage class for each org's registry seeded at signup", nil, false) // Environment EnvStackdomeEnv = StringVar("STACKDOME_ENV", "Runtime environment (DEVELOPMENT, PRODUCTION)", ptr("DEVELOPMENT"), false) // Test Overrides EnvTestJWTSecret = StringVar("TEST_JWT_SECRET", "Override JWT secret in tests", nil, false) EnvTestEncryptionKey = StringVar("TEST_ENCRYPTION_KEY", "Override encryption key in tests", nil, false) EnvTestLogLevel = StringVar("TEST_LOG_LEVEL", "Override log level in tests", ptr("info"), false) )
View Source
var ( ErrUnsupportedComputeMode = &ConfigError{"COMPUTE_MODE must be bring_your_own or shared"} ErrPlatformRoutingNotAllowed = &ConfigError{"platform routing is not allowed in bring_your_own compute mode"} ErrPlatformBaseDomainRequired = &ConfigError{"PLATFORM_BASE_DOMAIN is required in shared compute mode"} ErrPlatformTLSRequired = &ConfigError{"PLATFORM_TLS_ENABLED is required in stackdome_cloud runtime mode"} ErrPlatformTLSConfigNotAllowed = &ConfigError{"platform TLS configuration requires PLATFORM_TLS_ENABLED=true"} ErrPlatformEmailRequired = &ConfigError{"PLATFORM_EMAIL is required when platform TLS is enabled"} ErrPlatformCloudflareTokenRequired = &ConfigError{"PLATFORM_DNS_CLOUDFLARE_API_TOKEN is required when platform TLS is enabled"} ErrPlatformACMEEnvironmentInvalid = &ConfigError{"PLATFORM_ACME_ENVIRONMENT must be production or staging"} ErrPlatformTLSNamespaceRequired = &ConfigError{"PLATFORM_TLS_NAMESPACE is required when platform TLS is enabled"} )
Functions ¶
func ValidatePlatformRouting ¶
func ValidatePlatformRouting(runtime RuntimeMode, mode ComputeMode, platform *PlatformConfig) error
func ValidateSharedComputeProvisioning ¶
func ValidateSharedComputeProvisioning(mode ComputeMode, cluster *ClusterConfig) error
Types ¶
type ApplicationConfig ¶
type ApplicationConfig struct {
Server *ServerConfig `json:"server"`
Database *DatabaseConfig `json:"database"`
JwtSecret string `json:"jwt_secret"`
EncryptionKey string `json:"encryption_key"`
LogLevel string `json:"log_level"`
LogFormat string `json:"log_format"`
RuntimeMode RuntimeMode `json:"runtime_mode"`
ComputeMode ComputeMode `json:"compute_mode"`
StackdomeCloudConfigPath string `json:"stackdome_cloud_config_path"`
StackdomeCloud *StackdomeCloudConfig `json:"stackdome_cloud,omitempty"`
TurnstileSecret string `json:"-"`
GitHubOAuth *GitHubOAuthConfig `json:"github_oauth"`
// GitHubApp is the platform-wide GitHub App; unset means per-org apps.
GitHubApp *GitHubAppConfig `json:"github_app"`
// ServerExternalURL is the externally reachable base URL of the hub,
// required for the GitHub App manifest flow (browser redirects, webhooks).
ServerExternalURL string `json:"server_external_url"`
// GitHubAPIBaseURL overrides the GitHub API endpoint (tests, GHES).
GitHubAPIBaseURL string `json:"github_api_base_url"`
SharedComputeCluster *ClusterConfig `json:"shared_compute_cluster"`
}
func NewApplicationConfig ¶
func NewApplicationConfig() *ApplicationConfig
func (*ApplicationConfig) CustomDomainsEnabled ¶
func (c *ApplicationConfig) CustomDomainsEnabled() bool
func (*ApplicationConfig) ExternalPostgresImportEnabled ¶
func (c *ApplicationConfig) ExternalPostgresImportEnabled() bool
func (*ApplicationConfig) IsStackdomeCloud ¶
func (c *ApplicationConfig) IsStackdomeCloud() bool
func (*ApplicationConfig) LoadEnvVariables ¶
func (c *ApplicationConfig) LoadEnvVariables() error
func (*ApplicationConfig) LoadStackdomeCloudConfig ¶
func (c *ApplicationConfig) LoadStackdomeCloudConfig() error
func (*ApplicationConfig) UsesSharedCompute ¶
func (c *ApplicationConfig) UsesSharedCompute() bool
func (*ApplicationConfig) Validate ¶
func (c *ApplicationConfig) Validate() error
type ClusterConfig ¶
type ClusterConfig struct {
ClusterURL string `yaml:"cluster_url"`
ClusterCAData string `yaml:"cluster_ca_data"`
Token string `yaml:"token"`
}
func (*ClusterConfig) AnySet ¶
func (c *ClusterConfig) AnySet() bool
func (*ClusterConfig) IsSet ¶
func (c *ClusterConfig) IsSet() bool
func (*ClusterConfig) LoadEnvVariables ¶
func (c *ClusterConfig) LoadEnvVariables() error
func (*ClusterConfig) Validate ¶
func (c *ClusterConfig) Validate() error
type ConfigDuration ¶
func (ConfigDuration) Duration ¶
func (d ConfigDuration) Duration() time.Duration
func (*ConfigDuration) UnmarshalYAML ¶
func (d *ConfigDuration) UnmarshalYAML(value *yaml.Node) error
type ConfigError ¶
type ConfigError struct {
// contains filtered or unexported fields
}
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
type DBConnectionConfig ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Dialect string `json:"dialect"`
SSLMode SSLMode `json:"sslmode"`
RootCertFile string
Debug bool `json:"debug"`
MaxOpenConnections int `json:"max_connections"`
DBConnectionConfig
}
func NewDatabaseConfig ¶
func NewDatabaseConfig() *DatabaseConfig
func (*DatabaseConfig) ConnectionString ¶
func (c *DatabaseConfig) ConnectionString() string
func (*DatabaseConfig) ConnectionStringWithName ¶
func (c *DatabaseConfig) ConnectionStringWithName(name string, withSSL bool) string
func (*DatabaseConfig) LoadEnvVariables ¶
func (c *DatabaseConfig) LoadEnvVariables()
func (*DatabaseConfig) LogSafeConnectionString ¶
func (c *DatabaseConfig) LogSafeConnectionString(withSSL bool) string
func (*DatabaseConfig) LogSafeConnectionStringWithName ¶
func (c *DatabaseConfig) LogSafeConnectionStringWithName(name string, withSSL bool) string
func (*DatabaseConfig) Validate ¶
func (c *DatabaseConfig) Validate() error
type EnvVar ¶
type EnvVar[T any] struct { Name string Description string DefaultValue *T Required bool // contains filtered or unexported fields }
type GitHubAppConfig ¶
type GitHubAppConfig struct {
AppID int64 `json:"app_id"`
Slug string `json:"slug"`
PrivateKey string `json:"private_key"`
WebhookSecret string `json:"webhook_secret"`
}
GitHubAppConfig is the platform-wide GitHub App every org installs. Not configured: each org creates its own app through the manifest flow. Login uses the same app's client id/secret via the GITHUB_CLIENT_* vars.
func (*GitHubAppConfig) Configured ¶
func (c *GitHubAppConfig) Configured() bool
func (*GitHubAppConfig) LoadEnvVariables ¶
func (c *GitHubAppConfig) LoadEnvVariables()
type GitHubOAuthConfig ¶
type GitHubOAuthConfig struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
RedirectURI string `json:"redirect_uri"`
}
func NewGitHubOAuthConfig ¶
func NewGitHubOAuthConfig() *GitHubOAuthConfig
func (*GitHubOAuthConfig) Enabled ¶
func (c *GitHubOAuthConfig) Enabled() bool
func (*GitHubOAuthConfig) LoadEnvVariables ¶
func (c *GitHubOAuthConfig) LoadEnvVariables()
type PlatformConfig ¶
type PlatformConfig struct {
Email string
BaseDomain string
DNSCloudflareAPIToken string
PlatformTLSEnabled bool
ACMEEnvironment string
TLSNamespace string
OrgRegistry models.OrgRegistryDefaults
}
func NewPlatformConfig ¶
func NewPlatformConfig() *PlatformConfig
func (*PlatformConfig) ACMEDirectoryURL ¶
func (p *PlatformConfig) ACMEDirectoryURL() string
func (*PlatformConfig) LoadEnvVariables ¶
func (p *PlatformConfig) LoadEnvVariables() error
type RuntimeMode ¶
type RuntimeMode string
const ( RuntimeModeSelfHosted RuntimeMode = "self_hosted" RuntimeModeStackdomeCloud RuntimeMode = "stackdome_cloud" )
type ServerConfig ¶
type ServerConfig struct {
Hostname string `json:"hostname"`
BindAddress string `json:"bind_address"`
MetricsBindAddress string `json:"metrics_bind_address"`
}
func NewServerConfig ¶
func NewServerConfig() *ServerConfig
func (*ServerConfig) LoadEnvVariables ¶
func (c *ServerConfig) LoadEnvVariables()
func (*ServerConfig) Validate ¶
func (c *ServerConfig) Validate() error
type StackdomeCloudClientIPSource ¶
type StackdomeCloudClientIPSource string
const ( StackdomeCloudClientIPSourceCloudflare StackdomeCloudClientIPSource = "cloudflare" StackdomeCloudClientIPSourceRemoteAddr StackdomeCloudClientIPSource = "remote_addr" )
type StackdomeCloudComputeAccessConfig ¶
type StackdomeCloudComputeAccessConfig struct {
TrialEntitlementDuration ConfigDuration `yaml:"trialEntitlementDuration" json:"trial_entitlement_duration"`
}
StackdomeCloudComputeAccessConfig configures the default trial grant and the platform ceiling enforced when reserving shared compute.
type StackdomeCloudConfig ¶
type StackdomeCloudConfig struct {
Access StackdomeCloudComputeAccessConfig `yaml:"access" json:"access"`
Limits computequota.ComputeLimits `yaml:"limits" json:"limits"`
Registry StackdomeCloudRegistryConfig `yaml:"registry" json:"registry"`
Features StackdomeCloudFeaturesConfig `yaml:"features" json:"features"`
Signup StackdomeCloudSignupConfig `yaml:"signup" json:"signup"`
}
func LoadStackdomeCloudConfig ¶
func LoadStackdomeCloudConfig(path string) (*StackdomeCloudConfig, error)
func (*StackdomeCloudConfig) Validate ¶
func (c *StackdomeCloudConfig) Validate() error
type StackdomeCloudEmailThrottleConfig ¶
type StackdomeCloudEmailThrottleConfig struct {
MaxTrackedAddresses int `yaml:"maxTrackedAddresses" json:"max_tracked_addresses"`
MaxAttempts int `yaml:"maxAttempts" json:"max_attempts"`
Window ConfigDuration `yaml:"window" json:"window"`
}
type StackdomeCloudFeaturesConfig ¶
type StackdomeCloudFeaturesConfig struct {
CustomDomains bool `yaml:"customDomains" json:"custom_domains"`
ExternalPostgresImport bool `yaml:"externalPostgresImport" json:"external_postgres_import"`
// WorkspaceUsers is accepted only as false for compatibility with the first cloud config.
WorkspaceUsers bool `yaml:"workspaceUsers" json:"workspace_users"`
}
type StackdomeCloudIPThrottleConfig ¶
type StackdomeCloudIPThrottleConfig struct {
MaxTrackedClients int `yaml:"maxTrackedClients" json:"max_tracked_clients"`
MaxAttempts int `yaml:"maxAttempts" json:"max_attempts"`
Window ConfigDuration `yaml:"window" json:"window"`
}
type StackdomeCloudSignupConfig ¶
type StackdomeCloudSignupConfig struct {
ClientIPSource StackdomeCloudClientIPSource `yaml:"clientIPSource" json:"client_ip_source"`
Turnstile StackdomeCloudTurnstileConfig `yaml:"turnstile" json:"turnstile"`
// Throttle is always enforced in the Stackdome Cloud runtime.
Throttle StackdomeCloudThrottleConfig `yaml:"throttle" json:"throttle"`
}
type StackdomeCloudThrottleConfig ¶
type StackdomeCloudThrottleConfig struct {
IP StackdomeCloudIPThrottleConfig `yaml:"ip" json:"ip"`
Email StackdomeCloudEmailThrottleConfig `yaml:"email" json:"email"`
}
type StackdomeCloudTurnstileConfig ¶
type StackdomeCloudTurnstileConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
SiteKey string `yaml:"siteKey" json:"site_key"`
ExpectedHostname string `yaml:"expectedHostname" json:"expected_hostname"`
ExpectedAction string `yaml:"expectedAction" json:"expected_action"`
VerificationTimeout ConfigDuration `yaml:"verificationTimeout" json:"verification_timeout"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.