config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

SelectableEmulatorTypes lists the emulator types available for interactive selection, in the order they should be presented.

Functions

func CachePlanLabel added in v0.5.7

func CachePlanLabel(label string)

func CachedPlanLabel added in v0.5.7

func CachedPlanLabel() string

func ConfigDir

func ConfigDir() (string, error)

func ConfigFilePath

func ConfigFilePath() (string, error)

func EnsureCreated added in v0.12.0

func EnsureCreated() error

func FriendlyConfigPath added in v0.5.7

func FriendlyConfigPath() (string, error)

FriendlyConfigPath returns a human-readable config path: relative for project-local configs, ~-prefixed for paths under $HOME, absolute otherwise.

func InitFromPath added in v0.3.1

func InitFromPath(path string) error

func KnownImageRepos added in v0.7.0

func KnownImageRepos() []string

func KnownImageReposForType added in v0.7.0

func KnownImageReposForType(t EmulatorType) []string

func LicenseFilePath added in v0.5.8

func LicenseFilePath() (string, error)

LicenseFilePath returns the path where the license file is cached on the host. This file is written after a successful license validation and mounted read-only into containers so they can activate offline.

func Load added in v0.12.0

func Load() (firstRun bool, err error)

Load reads config.toml without creating it; callers that need to create the default config on first run should call EnsureCreated once ready to persist it (e.g. after an emulator-selection prompt, or after a successful default start).

func NormalizeTag added in v0.9.0

func NormalizeTag(tag string) string

NormalizeTag strips a leading zero from the month in calendar-versioned tags so they are accepted by the license API (e.g. "2026.04" → "2026.4"). Other tags pass through unchanged.

func Set added in v0.5.2

func Set(key string, value any) error

func SetEmulatorType added in v0.7.1

func SetEmulatorType(to EmulatorType) error

SetEmulatorType rewrites the emulator type in the config file and reloads. No-op if the requested type is already set.

func SetUpdateSkippedVersion added in v0.5.8

func SetUpdateSkippedVersion(version string) error

func TagSuggestion added in v0.17.0

func TagSuggestion() string

TagSuggestion returns an actionable hint naming a recent calendar tag and "latest", for messages about tags the license server cannot parse.

Types

type CLIConfig added in v0.5.8

type CLIConfig struct {
	UpdateSkippedVersion string `mapstructure:"update_skipped_version"`
}

type Config

type Config struct {
	Containers []ContainerConfig            `mapstructure:"containers"`
	Env        map[string]map[string]string `mapstructure:"env"`
	CLI        CLIConfig                    `mapstructure:"cli"`
}

func Get

func Get() (*Config, error)

type ContainerConfig

type ContainerConfig struct {
	Type EmulatorType `mapstructure:"type"`
	Tag  string       `mapstructure:"tag"`
	Port string       `mapstructure:"port"`
	// CustomImage overrides the default Docker image for this emulator. Set it to use an
	// image from an internal registry or a locally loaded offline image instead of pulling
	// the default localstack image from Docker Hub. If it carries no tag, Tag (or "latest")
	// is appended; if it already carries a tag, Tag is dropped.
	CustomImage string `mapstructure:"image"`
	// Volume is the legacy single-host-directory knob for the persistence mount
	// (target /var/lib/localstack). It is still honored; new configs can express the
	// same mount as a Volumes entry targeting persistenceTarget instead.
	Volume string `mapstructure:"volume"`
	// Volumes is the umbrella list of "host:container[:ro]" bind specs. It covers
	// arbitrary mounts (e.g. Snowflake init hooks) and may also contain the persistence
	// mount (the entry targeting /var/lib/localstack).
	Volumes []string `mapstructure:"volumes"`
	// Env is a list of named environment references defined in the top-level [env.*] config sections.
	Env []string `mapstructure:"env"`
	// Snapshot is an optional snapshot REF (e.g. "pod:my-baseline" or a local path)
	// auto-loaded after the emulator starts. AWS emulator only.
	Snapshot string `mapstructure:"snapshot"`
}

func (*ContainerConfig) ContainerPort added in v0.5.0

func (c *ContainerConfig) ContainerPort() (string, error)

func (*ContainerConfig) DisplayName added in v0.2.0

func (c *ContainerConfig) DisplayName() string

func (*ContainerConfig) ExtraVolumes added in v0.14.1

func (c *ContainerConfig) ExtraVolumes() ([]VolumeMount, error)

ExtraVolumes returns the parsed bind mounts EXCLUDING the persistence entry (target /var/lib/localstack), which start.go mounts separately via VolumeDir.

func (*ContainerConfig) HealthPath

func (c *ContainerConfig) HealthPath() (string, error)

func (*ContainerConfig) Image

func (c *ContainerConfig) Image() (string, error)

func (*ContainerConfig) Name

func (c *ContainerConfig) Name() string

Name returns the container name: "localstack-{type}" or "localstack-{type}-{tag}" if tag != latest

func (*ContainerConfig) ProductName

func (c *ContainerConfig) ProductName() (string, error)

func (*ContainerConfig) ResolvedEnv added in v0.3.1

func (c *ContainerConfig) ResolvedEnv(namedEnvs map[string]map[string]string) ([]string, error)

ResolvedEnv resolves the container's named environment references into KEY=value pairs. namedEnvs is the top-level [env.*] map from Config.

func (*ContainerConfig) Validate added in v0.5.1

func (c *ContainerConfig) Validate() error

func (*ContainerConfig) VolumeDir added in v0.5.2

func (c *ContainerConfig) VolumeDir() (string, error)

VolumeDir returns the host directory to mount into the container for persistence/caching (the mount targeting /var/lib/localstack). Resolution precedence:

  1. A Volumes entry targeting persistenceTarget — its resolved host source.
  2. The legacy Volume field, if set — returned as-is.
  3. The default os.UserCacheDir()/lstk/volume/<container-name>.

type EmulatorType

type EmulatorType string
const (
	EmulatorAWS       EmulatorType = "aws"
	EmulatorSnowflake EmulatorType = "snowflake"
	EmulatorAzure     EmulatorType = "azure"

	DefaultPort = "4566"
)

func EmulatorTypeForImage added in v0.7.0

func EmulatorTypeForImage(image string) EmulatorType

func ParseEmulatorType added in v0.18.0

func ParseEmulatorType(s string) (EmulatorType, error)

ParseEmulatorType validates a raw emulator type string against the selectable types and returns the corresponding EmulatorType.

func (EmulatorType) DisplayName added in v0.7.1

func (e EmulatorType) DisplayName() string

func (EmulatorType) SelectionKey added in v0.7.1

func (e EmulatorType) SelectionKey() string

func (EmulatorType) SelfValidatesLicense added in v0.11.0

func (e EmulatorType) SelfValidatesLicense() bool

SelfValidatesLicense reports whether the emulator container performs its own license activation on startup. For these emulators lstk skips its pre-flight platform license check (the LocalStack platform API has no catalog entry for them), and lets the container validate the token against the licensing server.

func (EmulatorType) ShortName added in v0.7.1

func (e EmulatorType) ShortName() string

type VolumeMount added in v0.14.1

type VolumeMount struct {
	Source   string
	Target   string
	ReadOnly bool
}

VolumeMount is a parsed bind specification with the host source resolved to an absolute path.

Jump to

Keyboard shortcuts

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