Documentation
¶
Index ¶
- Constants
- func ExtractFlagArgs(cfg any, args []string) ([]string, []string, error)
- func IsLocalDevelopmentHost(host string) bool
- func IsNonLocalDeploymentProfile(profile string) bool
- func LoadInto(path string, cfg any) error
- func LoadIntoWithArgs(path string, cfg any, args []string) error
- func ValidateDeploymentHTTPSURL(profile, value, field string) (*url.URL, error)
- func ValidateDeploymentPostgres(profile, host, user, password, sslMode string) error
- func ValidateDeploymentProfile(profile *string) error
- func ValidateHTTPOrigin(value, field string) (*url.URL, error)
- func ValidateHTTPURL(value, field string) (*url.URL, error)
- func ValidateNonLocalHTTPURL(value, field string) (*url.URL, error)
- func ValidateNonLocalHost(host, field string) error
- func ValidateNonLocalPostgres(host, user, password, sslMode string) error
- func ValidateProxyConfig(tomlName string, proxyHeader *string, trustedProxies []string, ...) error
- func ValidatePublicHTTPSURL(value, field string) (*url.URL, error)
- func ValidateRuntime(logLevel string, logEnvironment string, tracing *TracingConfig, ...) error
- type DatabaseConfig
- type DeploymentConfig
- type Duration
- func (d Duration) Milliseconds() int64
- func (d Duration) Seconds() float64
- func (d *Duration) Set(value string) error
- func (d Duration) String() string
- func (d Duration) TimeDuration() time.Duration
- func (d *Duration) UnmarshalTOML(value any) error
- func (d *Duration) UnmarshalText(text []byte) error
- type MetricsConfig
- type ProofConfig
- type SMTP
- type TLSConfig
- type TracingConfig
Constants ¶
const ( // DeploymentProfileLocal keeps developer and worktree defaults usable. DeploymentProfileLocal = "local" // DeploymentProfileStaging enables non-local startup safety checks for staging. DeploymentProfileStaging = "staging" // DeploymentProfileProduction enables non-local startup safety checks for production. DeploymentProfileProduction = "production" // DeploymentProfileSelfHosted retains production protections with private operator origins. DeploymentProfileSelfHosted = "self-hosted" )
Variables ¶
This section is empty.
Functions ¶
func ExtractFlagArgs ¶
ExtractFlagArgs separates shared config flags from command-specific arguments.
func IsLocalDevelopmentHost ¶
IsLocalDevelopmentHost reports whether a host is only suitable for local development.
func IsNonLocalDeploymentProfile ¶
IsNonLocalDeploymentProfile reports whether startup must enforce deployment safety checks.
func LoadInto ¶
LoadInto reads and parses a configuration file into cfg with this precedence: 1. Command-line flags (highest priority) 2. Environment variables 3. TOML config file 4. Default values (lowest priority)
func LoadIntoWithArgs ¶
LoadIntoWithArgs reads and parses a configuration file using an isolated flag set.
func ValidateDeploymentHTTPSURL ¶
ValidateDeploymentHTTPSURL permits private operator origins only in self-hosted deployments.
func ValidateDeploymentPostgres ¶
ValidateDeploymentPostgres enforces database settings for a deployment profile.
func ValidateDeploymentProfile ¶
ValidateDeploymentProfile normalizes and validates the deployment safety profile.
func ValidateHTTPOrigin ¶
ValidateHTTPOrigin trims and validates an HTTP or HTTPS origin value.
func ValidateHTTPURL ¶
ValidateHTTPURL trims and validates an absolute HTTP or HTTPS URL.
func ValidateNonLocalHTTPURL ¶
ValidateNonLocalHTTPURL rejects local hosts while allowing HTTP service URLs.
func ValidateNonLocalHost ¶
ValidateNonLocalHost rejects localhost, loopback, and wildcard host values.
func ValidateNonLocalPostgres ¶
ValidateNonLocalPostgres enforces database settings required outside local development.
func ValidateProxyConfig ¶
func ValidateProxyConfig( tomlName string, proxyHeader *string, trustedProxies []string, setTrustedProxy func(i int, value string), ) error
ValidateProxyConfig trims and validates a process-specific proxy header/trusted proxy pair.
func ValidatePublicHTTPSURL ¶
ValidatePublicHTTPSURL enforces an HTTPS URL with a non-local host for non-local profiles.
func ValidateRuntime ¶
func ValidateRuntime( logLevel string, logEnvironment string, tracing *TracingConfig, metrics *MetricsConfig, ) error
ValidateRuntime validates process-shared logging, tracing, and metrics settings.
Types ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `toml:"host" env:"DB_HOST" flag:"db-host" desc:"Database host"`
Port int `toml:"port" env:"DB_PORT" flag:"db-port" desc:"Database port"`
User string `toml:"user" env:"DB_USER" flag:"db-user" desc:"Database user"`
Password string `toml:"password" env:"DB_PASSWORD" flag:"db-password" desc:"Database password"`
Database string `toml:"database" env:"DB_DATABASE" flag:"db-database" desc:"Database name"`
SSLMode string `toml:"ssl_mode" env:"DB_SSL_MODE" flag:"db-ssl-mode" desc:"Database SSL mode"`
SSLRootCert string `` /* 127-byte string literal not displayed */
MaxConns int `toml:"max_conns" env:"DB_MAX_CONNS" flag:"db-max-conns" desc:"Database max connections"`
MinConns int `toml:"min_conns" env:"DB_MIN_CONNS" flag:"db-min-conns" desc:"Database min connections"`
MaxConnLifetime int `` /* 135-byte string literal not displayed */
MaxConnIdleTime int `` /* 136-byte string literal not displayed */
HealthCheckPeriod int `` /* 131-byte string literal not displayed */
}
DatabaseConfig contains shared PostgreSQL connection configuration.
func DefaultDatabaseConfig ¶
func DefaultDatabaseConfig() DatabaseConfig
DefaultDatabaseConfig returns the local PostgreSQL defaults shared by Braidplane processes.
func (*DatabaseConfig) ConnectionString ¶
func (d *DatabaseConfig) ConnectionString() string
ConnectionString returns the PostgreSQL connection string in URL format with all pool settings.
func (*DatabaseConfig) ConnectionURL ¶
func (d *DatabaseConfig) ConnectionURL() string
ConnectionURL returns the PostgreSQL connection URL without pool-specific parameters.
type DeploymentConfig ¶
type DeploymentConfig struct {
Profile string `` /* 140-byte string literal not displayed */
}
DeploymentConfig contains process deployment safety profile configuration.
type Duration ¶
Duration is a config-native duration value that parses consistently from TOML, env vars, and command-line flags using Go duration syntax such as "30s" or "1m".
func NewDuration ¶
func (Duration) Milliseconds ¶
func (Duration) TimeDuration ¶
func (*Duration) UnmarshalTOML ¶
func (*Duration) UnmarshalText ¶
type MetricsConfig ¶
type MetricsConfig struct {
Enabled bool `toml:"enabled" env:"METRICS_ENABLED" flag:"metrics-enabled" desc:"Expose Prometheus-compatible metrics endpoint"`
Path string `toml:"path" env:"METRICS_PATH" flag:"metrics-path" desc:"Prometheus-compatible metrics endpoint path"`
}
MetricsConfig contains Prometheus-compatible metrics exposure configuration.
type ProofConfig ¶
type ProofConfig struct {
GitChecksEnabled bool `` /* 158-byte string literal not displayed */
}
ProofConfig controls publication of Braidplane Proof results.
type SMTP ¶
type SMTP struct {
Host string `` /* 126-byte string literal not displayed */
User string `toml:"user" env:"SMTP_USER" flag:"smtp-user" desc:"SMTP username"`
Password string `toml:"password" env:"SMTP_PASSWORD" flag:"smtp-password" desc:"SMTP password"`
CACert string `` /* 133-byte string literal not displayed */
CACertFile string `` /* 146-byte string literal not displayed */
Insecure bool `` /* 138-byte string literal not displayed */
NoReplyAddress string `toml:"no_reply_address" env:"SMTP_NO_REPLY_ADDRESS" flag:"smtp-no-reply-address" desc:"No-reply email address"`
}
SMTP contains SMTP server configuration.
func (SMTP) ToTLSConfig ¶
ToTLSConfig converts SMTP config to TLSConfig.
func (SMTP) ValidateCredentials ¶
ValidateCredentials rejects partial SMTP authentication rather than silently using anonymous delivery.
type TracingConfig ¶
type TracingConfig struct {
OTLPTracesEndpoint string `` /* 166-byte string literal not displayed */
SamplingRatio float64 `` /* 145-byte string literal not displayed */
}
TracingConfig contains OpenTelemetry trace export and sampling configuration.