config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerNameParams added in v1.4.0

type ContainerNameParams struct {
	ServiceName string
	SpecName    string
	Type        string // "db", "http", "kafka", etc.
}

ContainerNameParams holds parameters for container name template substitution

type ContainerNaming added in v1.4.0

type ContainerNaming struct {
	DatabaseContainer string `yaml:"database_container"`  // Template for DB container name
	NetworkAlias      string `yaml:"network_alias"`       // Network alias for database (e.g., "real-db")
	KafkaContainer    string `yaml:"kafka_container"`     // Template for Kafka container name
	ProxyContainer    string `yaml:"proxy_container"`     // Template for proxy container name
	AppContainer      string `yaml:"app_container"`       // Template for app container name
	NetworkName       string `yaml:"network_name"`        // Template for network name
	MigrateContainer  string `yaml:"migrate_container"`   // Template for migration container name
	ProjectMountPath  string `yaml:"project_mount_path"`  // Mount path for project (default: /app/project)
	RegistryMountPath string `yaml:"registry_mount_path"` // Mount path for registry (default: /app/registry)
}

ContainerNaming defines configurable container and network naming Supports template variables: {{ .ServiceName }}, {{ .SpecName }}, {{ .Type }}

func (*ContainerNaming) GetAppContainer added in v1.4.0

func (c *ContainerNaming) GetAppContainer(params ContainerNameParams) string

GetAppContainer returns the app container name with template substitution

func (*ContainerNaming) GetDatabaseContainer added in v1.4.0

func (c *ContainerNaming) GetDatabaseContainer(params ContainerNameParams) string

GetDatabaseContainer returns the database container name with template substitution

func (*ContainerNaming) GetKafkaContainer added in v1.4.0

func (c *ContainerNaming) GetKafkaContainer(params ContainerNameParams) string

GetKafkaContainer returns the Kafka container name with template substitution

func (*ContainerNaming) GetMigrateContainer added in v1.4.0

func (c *ContainerNaming) GetMigrateContainer(params ContainerNameParams) string

GetMigrateContainer returns the migration container name with template substitution

func (*ContainerNaming) GetNetworkName added in v1.4.0

func (c *ContainerNaming) GetNetworkName(params ContainerNameParams) string

GetNetworkName returns the network name with template substitution

func (*ContainerNaming) GetProjectMountPath added in v1.4.0

func (c *ContainerNaming) GetProjectMountPath() string

GetProjectMountPath returns the project mount path

func (*ContainerNaming) GetProxyContainer added in v1.4.0

func (c *ContainerNaming) GetProxyContainer(params ContainerNameParams) string

GetProxyContainer returns the proxy container name with template substitution

func (*ContainerNaming) GetRegistryMountPath added in v1.4.0

func (c *ContainerNaming) GetRegistryMountPath() string

GetRegistryMountPath returns the registry mount path

type DatabaseConfig

type DatabaseConfig struct {
	Type       string `yaml:"type"` // mysql, postgresql
	Image      string `yaml:"image"`
	Port       int    `yaml:"port"`
	Container  string `yaml:"container"` // service name in docker-compose
	InitScript string `yaml:"init_script"`
	Database   string `yaml:"database"`
	Username   string `yaml:"username"`
	Password   string `yaml:"password"`
	Host       string `yaml:"host"`            // Host for external databases (when not using container)
	Proxy      *bool  `yaml:"proxy,omitempty"` // Whether to use a proxy for this database (enables interception)
}

DatabaseConfig defines database requirements

type DependencyConfig

type DependencyConfig struct {
	Name      string            `yaml:"name"`
	Type      string            `yaml:"type"` // http, database
	Host      string            `yaml:"host"`
	Port      int               `yaml:"port"`
	Proxy     bool              `yaml:"proxy"`      // Whether to mock this dependency
	HostAlias string            `yaml:"host_alias"` // Custom hostname alias for the service
	Headers   map[string]string `yaml:"headers,omitempty"`
}

DependencyConfig defines external service dependencies

type DjangoFrameworkConfig added in v1.4.0

type DjangoFrameworkConfig struct{}

DjangoFrameworkConfig implements FrameworkConfig for Django

func (*DjangoFrameworkConfig) GetMigrationCommand added in v1.4.0

func (d *DjangoFrameworkConfig) GetMigrationCommand() []string

func (*DjangoFrameworkConfig) GetStartCommand added in v1.4.0

func (d *DjangoFrameworkConfig) GetStartCommand(port string) []string

func (*DjangoFrameworkConfig) GetWarmupDelay added in v1.4.0

func (d *DjangoFrameworkConfig) GetWarmupDelay() time.Duration

func (*DjangoFrameworkConfig) GetWarmupEndpoint added in v1.4.0

func (d *DjangoFrameworkConfig) GetWarmupEndpoint() string

func (*DjangoFrameworkConfig) NeedsWarmup added in v1.4.0

func (d *DjangoFrameworkConfig) NeedsWarmup() bool

type EmbeddingConfig added in v1.3.0

type EmbeddingConfig struct {
	Provider            string  `yaml:"provider"`             // voyage, openai, etc.
	IndexModel          string  `yaml:"index_model"`          // e.g., voyage-4-large (for indexing documents at 2048 dims)
	QueryModel          string  `yaml:"query_model"`          // e.g., voyage-4-lite (for queries at 2048 dims)
	APIKey              string  `yaml:"api_key"`              // Can be "${ENV_VAR_NAME}" or literal
	SimilarityThreshold float64 `yaml:"similarity_threshold"` // default: 0.50
	IndexOnComplete     bool    `yaml:"index_on_complete"`    // default: true
}

EmbeddingConfig defines the embedding API configuration

type ExpressFrameworkConfig added in v1.4.0

type ExpressFrameworkConfig struct{}

ExpressFrameworkConfig implements FrameworkConfig for Node.js/Express

func (*ExpressFrameworkConfig) GetMigrationCommand added in v1.4.0

func (e *ExpressFrameworkConfig) GetMigrationCommand() []string

func (*ExpressFrameworkConfig) GetStartCommand added in v1.4.0

func (e *ExpressFrameworkConfig) GetStartCommand(port string) []string

func (*ExpressFrameworkConfig) GetWarmupDelay added in v1.4.0

func (e *ExpressFrameworkConfig) GetWarmupDelay() time.Duration

func (*ExpressFrameworkConfig) GetWarmupEndpoint added in v1.4.0

func (e *ExpressFrameworkConfig) GetWarmupEndpoint() string

func (*ExpressFrameworkConfig) NeedsWarmup added in v1.4.0

func (e *ExpressFrameworkConfig) NeedsWarmup() bool

type FastAPIFrameworkConfig added in v1.4.0

type FastAPIFrameworkConfig struct{}

FastAPIFrameworkConfig implements FrameworkConfig for FastAPI

func (*FastAPIFrameworkConfig) GetMigrationCommand added in v1.4.0

func (f *FastAPIFrameworkConfig) GetMigrationCommand() []string

func (*FastAPIFrameworkConfig) GetStartCommand added in v1.4.0

func (f *FastAPIFrameworkConfig) GetStartCommand(port string) []string

func (*FastAPIFrameworkConfig) GetWarmupDelay added in v1.4.0

func (f *FastAPIFrameworkConfig) GetWarmupDelay() time.Duration

func (*FastAPIFrameworkConfig) GetWarmupEndpoint added in v1.4.0

func (f *FastAPIFrameworkConfig) GetWarmupEndpoint() string

func (*FastAPIFrameworkConfig) NeedsWarmup added in v1.4.0

func (f *FastAPIFrameworkConfig) NeedsWarmup() bool

type FrameworkConfig added in v1.4.0

type FrameworkConfig interface {
	GetStartCommand(port string) []string
	GetMigrationCommand() []string
	NeedsWarmup() bool
	GetWarmupEndpoint() string
	GetWarmupDelay() time.Duration
}

FrameworkConfig defines the interface for framework-specific configuration

func GetFrameworkConfig added in v1.4.0

func GetFrameworkConfig(framework string, customStartCmd, customMigrationCmd string, needsWarmup bool, warmupEndpoint string, warmupDelayMs int) FrameworkConfig

GetFrameworkConfig returns the appropriate FrameworkConfig for a framework name

type GenericFrameworkConfig added in v1.4.0

type GenericFrameworkConfig struct {
	CustomStartCommand  string
	CustomMigrationCmd  string
	NeedsWarmupFlag     bool
	WarmupEndpointValue string
	WarmupDelayMs       int
}

GenericFrameworkConfig implements FrameworkConfig for custom/unknown frameworks

func (*GenericFrameworkConfig) GetMigrationCommand added in v1.4.0

func (g *GenericFrameworkConfig) GetMigrationCommand() []string

func (*GenericFrameworkConfig) GetStartCommand added in v1.4.0

func (g *GenericFrameworkConfig) GetStartCommand(port string) []string

func (*GenericFrameworkConfig) GetWarmupDelay added in v1.4.0

func (g *GenericFrameworkConfig) GetWarmupDelay() time.Duration

func (*GenericFrameworkConfig) GetWarmupEndpoint added in v1.4.0

func (g *GenericFrameworkConfig) GetWarmupEndpoint() string

func (*GenericFrameworkConfig) NeedsWarmup added in v1.4.0

func (g *GenericFrameworkConfig) NeedsWarmup() bool

type InfrastructureConfig

type InfrastructureConfig struct {
	Kafka      bool `yaml:"kafka"`
	Database   bool `yaml:"database"`
	Redis      bool `yaml:"redis"`
	ExternalDB bool `yaml:"external_db"` // Don't manage DB, service has its own
}

InfrastructureConfig defines required infrastructure

type LineSpecConfig

type LineSpecConfig struct {
	Service         ServiceConfig          `yaml:"service"`
	Database        *DatabaseConfig        `yaml:"database,omitempty"`
	Infrastructure  InfrastructureConfig   `yaml:"infrastructure"`
	Dependencies    []DependencyConfig     `yaml:"dependencies,omitempty"`
	Provenance      *ProvenanceConfig      `yaml:"provenance,omitempty"`
	ContainerNaming *ContainerNaming       `yaml:"container_naming,omitempty"`
	PortConfig      *PortConfig            `yaml:"ports,omitempty"`
	SchemaDiscovery *SchemaDiscoveryConfig `yaml:"schema_discovery,omitempty"`
	Payload         *PayloadConfig         `yaml:"payload,omitempty"`
	Created         time.Time              `yaml:"-"`
	BaseDir         string                 `yaml:"-"`
}

LineSpecConfig is the root configuration structure

func DefaultConfig

func DefaultConfig(framework string) *LineSpecConfig

Default configurations for common frameworks

func LoadConfig

func LoadConfig(startDir string) (*LineSpecConfig, error)

LoadConfig searches for .linespec.yml starting from the given directory and walking up to parent directories. Supports LINESPEC_CONFIG env var override.

func LoadConfigFile

func LoadConfigFile(path string) (*LineSpecConfig, error)

LoadConfigFile loads a specific .linespec.yml file

func (*LineSpecConfig) GetDockerComposePath

func (c *LineSpecConfig) GetDockerComposePath() string

GetDockerComposePath returns the absolute path to docker-compose.yml

func (*LineSpecConfig) GetHealthURL

func (c *LineSpecConfig) GetHealthURL(hostPort string) string

GetHealthURL returns the full health check URL

type PayloadConfig added in v1.4.0

type PayloadConfig struct {
	Directory        string            `yaml:"directory"`         // payload directory name (default: payloads)
	StatusField      string            `yaml:"status_field"`      // field path for HTTP status code (default: "status")
	AuthExtraction   map[string]string `yaml:"auth_extraction"`   // custom auth extraction rules
	SupportedFormats []string          `yaml:"supported_formats"` // list of supported formats
}

PayloadConfig defines payload loading and parsing configuration

type PortConfig added in v1.4.0

type PortConfig struct {
	MinPort        int  `yaml:"min_port"`         // Minimum port number for dynamic allocation
	MaxPort        int  `yaml:"max_port"`         // Maximum port number for dynamic allocation
	DynamicPorts   bool `yaml:"dynamic_ports"`    // Enable dynamic port allocation (default: true)
	FixedProxyPort int  `yaml:"fixed_proxy_port"` // Fixed port for proxy verification (0 = dynamic)
}

PortConfig defines dynamic port allocation settings

type ProvenanceConfig

type ProvenanceConfig struct {
	Enforcement       string           `yaml:"enforcement"`         // none | warn | strict
	Dir               string           `yaml:"dir"`                 // relative to repo root
	SharedRepos       []string         `yaml:"shared_repos"`        // paths or URLs to shared provenance repositories
	CommitTagRequired bool             `yaml:"commit_tag_required"` // whether commits must reference a prov ID
	AutoAffectedScope bool             `yaml:"auto_affected_scope"` // whether to auto-populate affected_scope from git diffs
	Embedding         *EmbeddingConfig `yaml:"embedding,omitempty"` // embedding API configuration
}

ProvenanceConfig defines provenance record settings

type RailsFrameworkConfig added in v1.4.0

type RailsFrameworkConfig struct{}

RailsFrameworkConfig implements FrameworkConfig for Ruby on Rails

func (*RailsFrameworkConfig) GetMigrationCommand added in v1.4.0

func (r *RailsFrameworkConfig) GetMigrationCommand() []string

func (*RailsFrameworkConfig) GetStartCommand added in v1.4.0

func (r *RailsFrameworkConfig) GetStartCommand(port string) []string

func (*RailsFrameworkConfig) GetWarmupDelay added in v1.4.0

func (r *RailsFrameworkConfig) GetWarmupDelay() time.Duration

func (*RailsFrameworkConfig) GetWarmupEndpoint added in v1.4.0

func (r *RailsFrameworkConfig) GetWarmupEndpoint() string

func (*RailsFrameworkConfig) NeedsWarmup added in v1.4.0

func (r *RailsFrameworkConfig) NeedsWarmup() bool

type SchemaDiscoveryConfig added in v1.4.0

type SchemaDiscoveryConfig struct {
	Mode          string   `yaml:"mode"`           // auto, static, none
	Tables        []string `yaml:"tables"`         // explicit list when mode is static
	ExcludeTables []string `yaml:"exclude_tables"` // tables to ignore in auto mode
	CacheFile     string   `yaml:"cache_file"`     // path to cache discovered schema
}

SchemaDiscoveryConfig defines schema discovery settings

type ServiceConfig

type ServiceConfig struct {
	Name             string            `yaml:"name"`
	ServiceDir       string            `yaml:"service_dir"` // Directory containing service code (e.g., "user-service")
	Type             string            `yaml:"type"`        // web, worker, consumer
	Framework        string            `yaml:"framework"`
	Port             int               `yaml:"port"`
	HealthEndpoint   string            `yaml:"health_endpoint"`
	DockerCompose    string            `yaml:"docker_compose"`
	BuildContext     string            `yaml:"build_context"`
	StartCommand     string            `yaml:"start_command"`
	MigrationCommand string            `yaml:"migration_command"`      // Custom migration command (overrides framework default)
	WarmupEndpoint   string            `yaml:"warmup_endpoint"`        // Custom warmup endpoint (overrides framework default)
	WarmupDelayMs    int               `yaml:"warmup_delay_ms"`        // Custom warmup delay in milliseconds
	NeedsWarmup      *bool             `yaml:"needs_warmup,omitempty"` // Whether framework needs warmup (overrides framework default)
	Environment      map[string]string `yaml:"environment"`
}

Jump to

Keyboard shortcuts

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