Documentation
¶
Index ¶
- Variables
- func CachePlanLabel(label string)
- func CachedPlanLabel() string
- func ConfigDir() (string, error)
- func ConfigFilePath() (string, error)
- func EnsureCreated() error
- func FriendlyConfigPath() (string, error)
- func InitFromPath(path string) error
- func KnownImageRepos() []string
- func KnownImageReposForType(t EmulatorType) []string
- func LicenseFilePath() (string, error)
- func Load() (firstRun bool, err error)
- func NormalizeTag(tag string) string
- func Set(key string, value any) error
- func SetEmulatorType(to EmulatorType) error
- func SetUpdateSkippedVersion(version string) error
- func TagSuggestion() string
- type CLIConfig
- type Config
- type ContainerConfig
- func (c *ContainerConfig) ContainerPort() (string, error)
- func (c *ContainerConfig) DisplayName() string
- func (c *ContainerConfig) ExtraVolumes() ([]VolumeMount, error)
- func (c *ContainerConfig) HealthPath() (string, error)
- func (c *ContainerConfig) Image() (string, error)
- func (c *ContainerConfig) Name() string
- func (c *ContainerConfig) ProductName() (string, error)
- func (c *ContainerConfig) ResolvedEnv(namedEnvs map[string]map[string]string) ([]string, error)
- func (c *ContainerConfig) Validate() error
- func (c *ContainerConfig) VolumeDir() (string, error)
- type EmulatorType
- type VolumeMount
Constants ¶
This section is empty.
Variables ¶
var SelectableEmulatorTypes = []EmulatorType{EmulatorAWS, EmulatorSnowflake, EmulatorAzure}
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 ConfigFilePath ¶
func EnsureCreated ¶ added in v0.12.0
func EnsureCreated() error
func FriendlyConfigPath ¶ added in v0.5.7
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 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
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
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
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 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 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"`
}
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
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:
- A Volumes entry targeting persistenceTarget — its resolved host source.
- The legacy Volume field, if set — returned as-is.
- 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
VolumeMount is a parsed bind specification with the host source resolved to an absolute path.