appconfig

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const AppConfigPath = ".miren/app.toml"

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Name        string                    `toml:"name"`
	PostImport  string                    `toml:"post_import"`
	EnvVars     []AppEnvVar               `toml:"env"`
	Concurrency *int                      `toml:"concurrency"`
	Services    map[string]*ServiceConfig `toml:"services"`
	Build       *BuildConfig              `toml:"build"`
	Include     []string                  `toml:"include"`
}

func GetDefaultsForServices

func GetDefaultsForServices(serviceNames []string) *AppConfig

GetDefaultsForServices returns an AppConfig with defaults resolved for given service names. This is useful for migration - it provides the same defaults used at build time.

func LoadAppConfig

func LoadAppConfig() (*AppConfig, error)

func LoadAppConfigUnder

func LoadAppConfigUnder(dir string) (*AppConfig, error)

func Parse

func Parse(data []byte) (*AppConfig, error)

func (*AppConfig) ResolveDefaults

func (ac *AppConfig) ResolveDefaults(services []string)

ResolveDefaults populates Services map for all service names with fully-resolved defaults. If a service already has explicit config in app.toml, it is preserved. Otherwise, defaults are applied based on service name:

  • "web": auto mode, requests_per_instance=10, scale_down_delay=15m
  • others: fixed mode, num_instances=1

func (*AppConfig) Validate

func (ac *AppConfig) Validate() error

Validate checks that the AppConfig has valid values

type AppEnvVar

type AppEnvVar struct {
	Key   string `json:"key" toml:"key"`
	Value string `json:"value" toml:"value"`
}

type BuildConfig

type BuildConfig struct {
	Dockerfile string   `toml:"dockerfile"`
	OnBuild    []string `toml:"onbuild"`
	Version    string   `toml:"version"`

	AlpineImage string `toml:"alpine_image"`
}

type DiskConfig

type DiskConfig struct {
	Name         string `toml:"name"`
	MountPath    string `toml:"mount_path"`
	ReadOnly     bool   `toml:"read_only"`
	SizeGB       int    `toml:"size_gb"`
	Filesystem   string `toml:"filesystem"`
	LeaseTimeout string `toml:"lease_timeout"`
}

DiskConfig represents a disk attachment for a service

type ServiceConcurrencyConfig

type ServiceConcurrencyConfig struct {
	Mode                string `toml:"mode"` // "auto" or "fixed"
	RequestsPerInstance int    `toml:"requests_per_instance"`
	ScaleDownDelay      string `toml:"scale_down_delay"` // e.g. "2m", "15m"
	NumInstances        int    `toml:"num_instances"`
}

ServiceConcurrencyConfig represents per-service concurrency configuration

type ServiceConfig

type ServiceConfig struct {
	Command     string                    `toml:"command"`
	Port        int                       `toml:"port"`
	PortName    string                    `toml:"port_name"`
	PortType    string                    `toml:"port_type"`
	Image       string                    `toml:"image"`
	EnvVars     []AppEnvVar               `toml:"env"`
	Concurrency *ServiceConcurrencyConfig `toml:"concurrency"`
	Disks       []DiskConfig              `toml:"disks"`
}

ServiceConfig represents configuration for a specific service

Jump to

Keyboard shortcuts

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