Documentation
¶
Overview ¶
Package config holds simrun's configuration types: env-only Bootstrap, DB-backed AppConfig, and the in-memory pack shapes used by the parser and runner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
Parallelism int `json:"parallelism"`
TerraformVersion string `json:"terraform_version"`
PackLogsEnabled bool `json:"pack_logs_enabled"`
SSHLoggingEnabled bool `json:"ssh_logging_enabled"`
AssessmentLogRetentionEnabled bool `json:"assessment_log_retention_enabled"`
AssessmentLogRetentionDays int `json:"assessment_log_retention_days"`
AssessmentRetentionEnabled bool `json:"assessment_retention_enabled"`
AssessmentRetentionDays int `json:"assessment_retention_days"`
}
AppConfig holds operational defaults that admins tune via the UI. Stored in the app_config table (one JSON value per key). Read via db.ConfigStore.
Fields here are intentionally narrow: anything that varies per-target belongs in connectors, anything secret belongs in secret_groups, anything set at deploy belongs in Bootstrap.
func DefaultAppConfig ¶
func DefaultAppConfig() AppConfig
DefaultAppConfig returns the default values used when no row exists for a key. Keep these aligned with the migration that backfills app_config.
type AuthBootstrap ¶
type AuthBootstrap struct {
GoogleClientID string
GoogleClientSecret string
AllowedDomain string
SessionTTL time.Duration
}
AuthBootstrap holds Google OAuth bootstrap config. The client secret is a credential and is read from env only.
type Bootstrap ¶
type Bootstrap struct {
DatabaseURL string
WebPort string
DataDir string
Debug bool
EncryptionKey string
DevMode bool
WebURL string
Auth AuthBootstrap
}
Bootstrap holds operator-set, deploy-time configuration loaded from environment variables. It is immutable for the lifetime of the process and is passed by dependency injection from main.go to services that need it.
Bootstrap is the ONLY surface that reads SR_* env vars in v4. Everything else (Elastic/Datadog/AWS/GCP/Azure/K8s/SSH credentials, parallelism, terraform version, pack-logs and ssh-logs toggles) lives in the database.
func LoadBootstrap ¶
LoadBootstrap reads the bootstrap surface from environment variables. Returns an error if SR_DATABASE_URL is missing.
type PackConfig ¶
type PackConfig struct {
Name string `yaml:"name"`
Type PackType `yaml:"type"`
Source string `yaml:"source"`
Version string `yaml:"version,omitempty"`
Parameters map[string]any `yaml:"-" json:"-"`
}
PackConfig is the in-memory shape used by the parser and runner factory to look up pack metadata. Source is interpreted based on Type:
- local: filesystem path to the pack binary
- remote: GitHub repository (e.g., github.com/org/repo)
- upload: filesystem path to a UI-uploaded binary
func (PackConfig) IsLocal ¶
func (p PackConfig) IsLocal() bool
IsLocal returns true if this is a local binary pack.
func (PackConfig) IsRemote ¶
func (p PackConfig) IsRemote() bool
IsRemote returns true if this is a remote (GitHub) binary pack.
type PackType ¶
type PackType string
PackType represents the type of pack.
const ( // PackTypeLocal is a local binary pack referenced by filesystem path. PackTypeLocal PackType = "local" // PackTypeRemote is a pack downloaded from a GitHub release. PackTypeRemote PackType = "remote" // PackTypeUpload is a binary pack uploaded via the web UI. PackTypeUpload PackType = "upload" )