{"modulePath":"github.com/Stackdome/stackdome","version":"v0.0.7-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package config\n\n## Constants\n\n```go\nconst (\n\tEnvironmentTest        = \"test\"\n\tEnvironmentDevelopment = \"development\"\n\tEnvironmentProduction  = \"production\"\n)\n```\n\n```go\nconst (\n\tACMEEnvironmentProduction   = \"production\"\n\tACMEEnvironmentStaging      = \"staging\"\n\tDefaultPlatformTLSNamespace = \"stackdome-control-plane\"\n\tACMEProductionDirectoryURL  = \"https://acme-v02.api.letsencrypt.org/directory\"\n\tACMEStagingDirectoryURL     = \"https://acme-staging-v02.api.letsencrypt.org/directory\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// Application\n\tEnvJWTSecret            = StringVar(\"JWT_SECRET\", \"JWT token signing secret\", nil, true)\n\tEnvLogLevel             = StringVar(\"LOG_LEVEL\", \"Logging level (debug, info, warn, error)\", ptr(\"info\"), false)\n\tEnvLogFormat            = StringVar(\"LOG_FORMAT\", \"Log output format (json or text)\", ptr(\"json\"), false)\n\tEnvEncryptionKey        = StringVar(\"ENCRYPTION_KEY\", \"Master encryption key (64-1024 chars)\", nil, true)\n\tEnvRuntimeMode          = StringVar(\"RUNTIME_MODE\", \"Runtime mode (self_hosted or stackdome_cloud)\", ptr(string(RuntimeModeSelfHosted)), false)\n\tEnvComputeMode          = StringVar(\"COMPUTE_MODE\", \"Compute mode (bring_your_own or shared)\", ptr(string(ComputeModeBYOC)), false)\n\tEnvStackdomeCloudConfig = StringVar(\"STACKDOME_CLOUD_CONFIG\", \"Path to the Stackdome Cloud runtime configuration\", nil, false)\n\tEnvTurnstileSecret      = StringVar(\"TURNSTILE_SECRET\", \"Cloudflare Turnstile secret for signup verification\", nil, false)\n\t// GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET are used for GitHub OAuth login\n\tEnvGitHubClientID     = StringVar(\"GITHUB_CLIENT_ID\", \"GitHub OAuth app client ID\", nil, false)\n\tEnvGitHubClientSecret = StringVar(\"GITHUB_CLIENT_SECRET\", \"GitHub OAuth app client secret\", nil, false)\n\tEnvGitHubRedirectURI  = StringVar(\"GITHUB_REDIRECT_URI\", \"GitHub OAuth app redirect URI (optional; derived from SERVER_EXTERNAL_URL when unset)\", nil, false)\n\t// The GITHUB_APP_* vars configure one platform-wide GitHub App that every\n\t// org installs; unset leaves each org creating its own app via the\n\t// manifest flow.\n\tEnvGitHubAppID            = IntVar(\"GITHUB_APP_ID\", \"Platform GitHub App numeric ID\", nil, false)\n\tEnvGitHubAppSlug          = StringVar(\"GITHUB_APP_SLUG\", \"Platform GitHub App URL slug\", nil, false)\n\tEnvGitHubAppPrivateKey    = StringVar(\"GITHUB_APP_PRIVATE_KEY\", \"Platform GitHub App private key (PEM)\", nil, false)\n\tEnvGitHubAppWebhookSecret = StringVar(\"GITHUB_APP_WEBHOOK_SECRET\", \"Platform GitHub App webhook secret\", nil, false)\n\n\t// Server\n\tEnvServerHostname    = StringVar(\"SERVER_HOSTNAME\", \"Server hostname/domain\", nil, false)\n\tEnvServerExternalURL = StringVar(\"SERVER_EXTERNAL_URL\", \"Externally reachable base URL of the hub (used for GitHub App callbacks and webhooks)\", nil, false)\n\t// GitHub API base URL override (httptest stubs / GHES)\n\tEnvGitHubAPIBaseURL   = StringVar(\"GITHUB_API_BASE_URL\", \"GitHub API base URL\", ptr(\"https://api.github.com\"), false)\n\tEnvServerBindAddress  = StringVar(\"SERVER_BIND_ADDRESS\", \"Server bind address and port\", ptr(\"0.0.0.0:8000\"), false)\n\tEnvMetricsBindAddress = StringVar(\"METRICS_BIND_ADDRESS\", \"Internal Prometheus metrics bind address\", ptr(\"0.0.0.0:9090\"), false)\n\n\t// Database\n\tEnvDBHost           = StringVar(\"DB_HOST\", \"PostgreSQL host\", nil, true)\n\tEnvDBPort           = IntVar(\"DB_PORT\", \"PostgreSQL port\", nil, true)\n\tEnvDBName           = StringVar(\"DB_NAME\", \"Database name\", nil, true)\n\tEnvDBUsername       = StringVar(\"DB_USERNAME\", \"Database user\", nil, true)\n\tEnvDBPassword       = StringVar(\"DB_PASSWORD\", \"Database password\", nil, true)\n\tEnvDBSSLMode        = StringVar(\"DB_SSL_MODE\", \"SSL mode (disable or require)\", ptr(\"disable\"), false)\n\tEnvDBMaxConnections = IntVar(\"DB_MAX_CONNECTIONS\", \"Max open DB connections\", ptr(50), false)\n\tEnvDBRootCertFile   = StringVar(\"DB_ROOT_CERT_FILE\", \"Root CA cert path for SSL\", nil, false)\n\tEnvDBDebugMode      = BoolVar(\"DB_DEBUG_MODE\", \"Enable DB query debug logging\", ptr(false), false)\n\n\t// Shared Compute Cluster\n\tEnvSharedComputeClusterAPIURL = StringVar(\"SHARED_COMPUTE_CLUSTER_API_URL\", \"Shared compute cluster API URL\", nil, false)\n\tEnvSharedComputeClusterCAData = StringVar(\"SHARED_COMPUTE_CLUSTER_CA_DATA\", \"Shared compute cluster CA cert (base64)\", nil, false)\n\tEnvSharedComputeClusterToken  = StringVar(\"SHARED_COMPUTE_CLUSTER_TOKEN\", \"Shared compute cluster auth token\", nil, false)\n\n\t// Platform routing and TLS\n\tEnvPlatformEmail                   = StringVar(\"PLATFORM_EMAIL\", \"Operator contact email; ACME contact for the platform TLS issuer\", nil, false)\n\tEnvPlatformBaseDomain              = StringVar(\"PLATFORM_BASE_DOMAIN\", \"Base domain for the platform org and per-org subdomains\", nil, false)\n\tEnvPlatformDNSCloudflareAPIToken   = StringVar(\"PLATFORM_DNS_CLOUDFLARE_API_TOKEN\", \"Cloudflare API token used for platform wildcard DNS challenges\", nil, false)\n\tEnvPlatformTLSEnabled              = BoolVar(\"PLATFORM_TLS_ENABLED\", \"Enable platform-managed TLS on shared compute\", ptr(false), false)\n\tEnvPlatformACMEEnvironment         = StringVar(\"PLATFORM_ACME_ENVIRONMENT\", \"Let's Encrypt ACME environment (production or staging)\", nil, false)\n\tEnvPlatformTLSNamespace            = StringVar(\"PLATFORM_TLS_NAMESPACE\", \"Namespace for platform TLS resources\", nil, false)\n\tEnvPlatformOrgRegistryStorageSize  = StringVar(\"PLATFORM_ORG_REGISTRY_STORAGE_SIZE\", \"Default storage size for each org's registry seeded at signup\", ptr(models.DefaultPlatformOrgRegistryStorageSize), false)\n\tEnvPlatformOrgRegistryStorageClass = StringVar(\"PLATFORM_ORG_REGISTRY_STORAGE_CLASS\", \"Default storage class for each org's registry seeded at signup\", nil, false)\n\n\t// Environment\n\tEnvStackdomeEnv = StringVar(\"STACKDOME_ENV\", \"Runtime environment (DEVELOPMENT, PRODUCTION)\", ptr(\"DEVELOPMENT\"), false)\n\n\t// Test Overrides\n\tEnvTestJWTSecret     = StringVar(\"TEST_JWT_SECRET\", \"Override JWT secret in tests\", nil, false)\n\tEnvTestEncryptionKey = StringVar(\"TEST_ENCRYPTION_KEY\", \"Override encryption key in tests\", nil, false)\n\tEnvTestLogLevel      = StringVar(\"TEST_LOG_LEVEL\", \"Override log level in tests\", ptr(\"info\"), false)\n)\n```\n\n```go\nvar (\n\tErrIncompleteSharedComputeClusterConfig = \u0026ConfigError{\"SHARED_COMPUTE_CLUSTER_API_URL, SHARED_COMPUTE_CLUSTER_CA_DATA and SHARED_COMPUTE_CLUSTER_TOKEN must all be set together\"}\n\tErrUnsupportedComputeMode               = \u0026ConfigError{\"COMPUTE_MODE must be bring_your_own or shared\"}\n\tErrSharedComputeProvisioningRequired    = \u0026ConfigError{\"shared compute provisioning is required in shared compute mode\"}\n\tErrSharedComputeProvisioningNotAllowed  = \u0026ConfigError{\"shared compute provisioning is not allowed in bring_your_own compute mode\"}\n\tErrPlatformRoutingNotAllowed            = \u0026ConfigError{\"platform routing is not allowed in bring_your_own compute mode\"}\n\tErrPlatformBaseDomainRequired           = \u0026ConfigError{\"PLATFORM_BASE_DOMAIN is required in shared compute mode\"}\n\tErrPlatformTLSRequired                  = \u0026ConfigError{\"PLATFORM_TLS_ENABLED is required in stackdome_cloud runtime mode\"}\n\tErrPlatformTLSConfigNotAllowed          = \u0026ConfigError{\"platform TLS configuration requires PLATFORM_TLS_ENABLED=true\"}\n\tErrPlatformEmailRequired                = \u0026ConfigError{\"PLATFORM_EMAIL is required when platform TLS is enabled\"}\n\tErrPlatformCloudflareTokenRequired      = \u0026ConfigError{\"PLATFORM_DNS_CLOUDFLARE_API_TOKEN is required when platform TLS is enabled\"}\n\tErrPlatformACMEEnvironmentInvalid       = \u0026ConfigError{\"PLATFORM_ACME_ENVIRONMENT must be production or staging\"}\n\tErrPlatformTLSNamespaceRequired         = \u0026ConfigError{\"PLATFORM_TLS_NAMESPACE is required when platform TLS is enabled\"}\n)\n```\n\n## Functions\n\n```go\nfunc ValidatePlatformRouting(runtime RuntimeMode, mode ComputeMode, platform *PlatformConfig) error\n```\n\n```go\nfunc ValidateSharedComputeProvisioning(mode ComputeMode, cluster *ClusterConfig) error\n```\n\n## Types\n\n```go\ntype ApplicationConfig struct {\n\tServer                   *ServerConfig         `json:\"server\"`\n\tDatabase                 *DatabaseConfig       `json:\"database\"`\n\tJwtSecret                string                `json:\"jwt_secret\"`\n\tEncryptionKey            string                `json:\"encryption_key\"`\n\tLogLevel                 string                `json:\"log_level\"`\n\tLogFormat                string                `json:\"log_format\"`\n\tRuntimeMode              RuntimeMode           `json:\"runtime_mode\"`\n\tComputeMode              ComputeMode           `json:\"compute_mode\"`\n\tStackdomeCloudConfigPath string                `json:\"stackdome_cloud_config_path\"`\n\tStackdomeCloud           *StackdomeCloudConfig `json:\"stackdome_cloud,omitempty\"`\n\tTurnstileSecret          string                `json:\"-\"`\n\tGitHubOAuth              *GitHubOAuthConfig    `json:\"github_oauth\"`\n\t// GitHubApp is the platform-wide GitHub App; unset means per-org apps.\n\tGitHubApp *GitHubAppConfig `json:\"github_app\"`\n\t// ServerExternalURL is the externally reachable base URL of the hub,\n\t// required for the GitHub App manifest flow (browser redirects, webhooks).\n\tServerExternalURL string `json:\"server_external_url\"`\n\t// GitHubAPIBaseURL overrides the GitHub API endpoint (tests, GHES).\n\tGitHubAPIBaseURL string `json:\"github_api_base_url\"`\n\t// SharedComputeCluster holds the SHARED_COMPUTE_CLUSTER_* configuration.\n\tSharedComputeCluster *ClusterConfig `json:\"shared_compute_cluster\"`\n}\n```\n\n```go\nfunc NewApplicationConfig() *ApplicationConfig\n```\n\n```go\nfunc (c *ApplicationConfig) CustomDomainsEnabled() bool\n```\n\n```go\nfunc (c *ApplicationConfig) ExternalPostgresImportEnabled() bool\n```\n\n```go\nfunc (c *ApplicationConfig) IsStackdomeCloud() bool\n```\n\n```go\nfunc (c *ApplicationConfig) LoadEnvVariables() error\n```\n\n```go\nfunc (c *ApplicationConfig) LoadStackdomeCloudConfig() error\n```\n\n```go\nfunc (c *ApplicationConfig) UsesSharedCompute() bool\n```\n\n```go\nfunc (c *ApplicationConfig) Validate() error\n```\n\n```go\ntype ClusterConfig struct {\n\tClusterURL    string `yaml:\"cluster_url\"`\n\tClusterCAData string `yaml:\"cluster_ca_data\"`\n\tToken         string `yaml:\"token\"`\n}\n```\n\n```go\nfunc (c *ClusterConfig) AnySet() bool\n```\n\n```go\nfunc (c *ClusterConfig) IsSet() bool\n```\n\n```go\nfunc (c *ClusterConfig) LoadEnvVariables() error\n```\n\n```go\nfunc (c *ClusterConfig) Validate() error\n```\n\n```go\ntype ComputeMode string\n```\n\n```go\nconst (\n\tComputeModeBYOC   ComputeMode = \"bring_your_own\"\n\tComputeModeShared ComputeMode = \"shared\"\n)\n```\n\n```go\ntype ConfigDuration time.Duration\n```\n\n```go\nfunc (d ConfigDuration) Duration() time.Duration\n```\n\n```go\nfunc (d *ConfigDuration) UnmarshalYAML(value *yaml.Node) error\n```\n\n```go\ntype ConfigError struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (e *ConfigError) Error() string\n```\n\n```go\ntype DBConnectionConfig struct {\n\tHost     string `json:\"host\" yaml:\"host\"`\n\tPort     int    `json:\"port\" yaml:\"port\"`\n\tName     string `json:\"name\" yaml:\"name\"`\n\tUsername string `json:\"username\" yaml:\"username\"`\n\tPassword string `json:\"password\" yaml:\"password\"`\n}\n```\n\n```go\ntype DatabaseConfig struct {\n\tDialect            string  `json:\"dialect\"`\n\tSSLMode            SSLMode `json:\"sslmode\"`\n\tRootCertFile       string\n\tDebug              bool `json:\"debug\"`\n\tMaxOpenConnections int  `json:\"max_connections\"`\n\tDBConnectionConfig\n}\n```\n\n```go\nfunc NewDatabaseConfig() *DatabaseConfig\n```\n\n```go\nfunc (c *DatabaseConfig) ConnectionString() string\n```\n\n```go\nfunc (c *DatabaseConfig) ConnectionStringWithName(name string, withSSL bool) string\n```\n\n```go\nfunc (c *DatabaseConfig) LoadEnvVariables()\n```\n\n```go\nfunc (c *DatabaseConfig) LogSafeConnectionString(withSSL bool) string\n```\n\n```go\nfunc (c *DatabaseConfig) LogSafeConnectionStringWithName(name string, withSSL bool) string\n```\n\n```go\nfunc (c *DatabaseConfig) Validate() error\n```\n\n```go\ntype EnvVar[T any] struct {\n\tName         string\n\tDescription  string\n\tDefaultValue *T\n\tRequired     bool\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc BoolVar(name, description string, defaultVal *bool, required bool) EnvVar[bool]\n```\n\n```go\nfunc IntVar(name, description string, defaultVal *int, required bool) EnvVar[int]\n```\n\n```go\nfunc StringVar(name, description string, defaultVal *string, required bool) EnvVar[string]\n```\n\n```go\nfunc (e EnvVar[T]) Lookup() (T, bool)\n```\n\n```go\ntype GitHubAppConfig struct {\n\tAppID         int64  `json:\"app_id\"`\n\tSlug          string `json:\"slug\"`\n\tPrivateKey    string `json:\"private_key\"`\n\tWebhookSecret string `json:\"webhook_secret\"`\n}\n```\nGitHubAppConfig 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.\n\n```go\nfunc (c *GitHubAppConfig) Configured() bool\n```\n\n```go\nfunc (c *GitHubAppConfig) LoadEnvVariables()\n```\n\n```go\ntype GitHubOAuthConfig struct {\n\tClientID     string `json:\"client_id\"`\n\tClientSecret string `json:\"client_secret\"`\n\tRedirectURI  string `json:\"redirect_uri\"`\n}\n```\n\n```go\nfunc NewGitHubOAuthConfig() *GitHubOAuthConfig\n```\n\n```go\nfunc (c *GitHubOAuthConfig) Enabled() bool\n```\n\n```go\nfunc (c *GitHubOAuthConfig) LoadEnvVariables()\n```\n\n```go\ntype PlatformConfig struct {\n\tEmail                 string\n\tBaseDomain            string\n\tDNSCloudflareAPIToken string\n\tPlatformTLSEnabled    bool\n\tACMEEnvironment       string\n\tTLSNamespace          string\n\tOrgRegistry           models.OrgRegistryDefaults\n}\n```\n\n```go\nfunc NewPlatformConfig() *PlatformConfig\n```\n\n```go\nfunc (p *PlatformConfig) ACMEDirectoryURL() string\n```\n\n```go\nfunc (p *PlatformConfig) LoadEnvVariables() error\n```\n\n```go\ntype RuntimeMode string\n```\n\n```go\nconst (\n\tRuntimeModeSelfHosted     RuntimeMode = \"self_hosted\"\n\tRuntimeModeStackdomeCloud RuntimeMode = \"stackdome_cloud\"\n)\n```\n\n```go\ntype SSLMode string\n```\n\n```go\nconst (\n\tDBSSLModeDisable SSLMode = \"disable\"\n\tDBSSLModeRequire SSLMode = \"require\"\n)\n```\n\n```go\ntype ServerConfig struct {\n\tHostname           string `json:\"hostname\"`\n\tBindAddress        string `json:\"bind_address\"`\n\tMetricsBindAddress string `json:\"metrics_bind_address\"`\n}\n```\n\n```go\nfunc NewServerConfig() *ServerConfig\n```\n\n```go\nfunc (c *ServerConfig) LoadEnvVariables()\n```\n\n```go\nfunc (c *ServerConfig) Validate() error\n```\n\n```go\ntype StackdomeCloudClientIPSource string\n```\n\n```go\nconst (\n\tStackdomeCloudClientIPSourceCloudflare StackdomeCloudClientIPSource = \"cloudflare\"\n\tStackdomeCloudClientIPSourceRemoteAddr StackdomeCloudClientIPSource = \"remote_addr\"\n)\n```\n\n```go\ntype StackdomeCloudComputeAccessConfig struct {\n\tMaxActiveSharedComputeLeases int            `yaml:\"maxActiveSharedComputeLeases\" json:\"max_active_shared_compute_leases\"`\n\tTrialEntitlementDuration     ConfigDuration `yaml:\"trialEntitlementDuration\" json:\"trial_entitlement_duration\"`\n}\n```\nStackdomeCloudComputeAccessConfig configures the default trial grant and the platform ceiling enforced when reserving shared compute.\n\n```go\ntype StackdomeCloudConfig struct {\n\tAccess   StackdomeCloudComputeAccessConfig `yaml:\"access\" json:\"access\"`\n\tLimits   computequota.ComputeLimits        `yaml:\"limits\" json:\"limits\"`\n\tRegistry StackdomeCloudRegistryConfig      `yaml:\"registry\" json:\"registry\"`\n\tFeatures StackdomeCloudFeaturesConfig      `yaml:\"features\" json:\"features\"`\n\tSignup   StackdomeCloudSignupConfig        `yaml:\"signup\" json:\"signup\"`\n}\n```\n\n```go\nfunc LoadStackdomeCloudConfig(path string) (*StackdomeCloudConfig, error)\n```\n\n```go\nfunc (c *StackdomeCloudConfig) Validate() error\n```\n\n```go\ntype StackdomeCloudEmailThrottleConfig struct {\n\tMaxTrackedAddresses int            `yaml:\"maxTrackedAddresses\" json:\"max_tracked_addresses\"`\n\tMaxAttempts         int            `yaml:\"maxAttempts\" json:\"max_attempts\"`\n\tWindow              ConfigDuration `yaml:\"window\" json:\"window\"`\n}\n```\n\n```go\ntype StackdomeCloudFeaturesConfig struct {\n\tCustomDomains          bool `yaml:\"customDomains\" json:\"custom_domains\"`\n\tExternalPostgresImport bool `yaml:\"externalPostgresImport\" json:\"external_postgres_import\"`\n\t// WorkspaceUsers is accepted only as false for compatibility with the first cloud config.\n\tWorkspaceUsers bool `yaml:\"workspaceUsers\" json:\"workspace_users\"`\n}\n```\n\n```go\ntype StackdomeCloudIPThrottleConfig struct {\n\tMaxTrackedClients int            `yaml:\"maxTrackedClients\" json:\"max_tracked_clients\"`\n\tMaxAttempts       int            `yaml:\"maxAttempts\" json:\"max_attempts\"`\n\tWindow            ConfigDuration `yaml:\"window\" json:\"window\"`\n}\n```\n\n```go\ntype StackdomeCloudRegistryConfig struct {\n\tMaxActiveRegistries int    `yaml:\"maxActiveRegistries\" json:\"max_active_registries\"`\n\tStorageClass        string `yaml:\"storageClass\" json:\"storage_class\"`\n\tStorageSize         string `yaml:\"storageSize\" json:\"storage_size\"`\n}\n```\n\n```go\ntype StackdomeCloudSignupConfig struct {\n\tClientIPSource StackdomeCloudClientIPSource  `yaml:\"clientIPSource\" json:\"client_ip_source\"`\n\tTurnstile      StackdomeCloudTurnstileConfig `yaml:\"turnstile\" json:\"turnstile\"`\n\t// Throttle is always enforced in the Stackdome Cloud runtime.\n\tThrottle StackdomeCloudThrottleConfig `yaml:\"throttle\" json:\"throttle\"`\n}\n```\n\n```go\ntype StackdomeCloudThrottleConfig struct {\n\tIP    StackdomeCloudIPThrottleConfig    `yaml:\"ip\" json:\"ip\"`\n\tEmail StackdomeCloudEmailThrottleConfig `yaml:\"email\" json:\"email\"`\n}\n```\n\n```go\ntype StackdomeCloudTurnstileConfig struct {\n\tEnabled             bool           `yaml:\"enabled\" json:\"enabled\"`\n\tSiteKey             string         `yaml:\"siteKey\" json:\"site_key\"`\n\tExpectedHostname    string         `yaml:\"expectedHostname\" json:\"expected_hostname\"`\n\tExpectedAction      string         `yaml:\"expectedAction\" json:\"expected_action\"`\n\tVerificationTimeout ConfigDuration `yaml:\"verificationTimeout\" json:\"verification_timeout\"`\n}\n```\n\n","path":"github.com/Stackdome/stackdome/config","name":"config","synopsis":"","isRedistributable":true}
