globals

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultEnvoyVersionsURL is the default value for GlobalOpts.EnvoyVersionsURL
	DefaultEnvoyVersionsURL = "https://archive.tetratelabs.io/envoy/envoy-versions.json"
	// DefaultEnvoyVersionsSchemaURL is the JSON schema used to validate GlobalOpts.EnvoyVersionsURL
	DefaultEnvoyVersionsSchemaURL = "https://archive.tetratelabs.io/release-versions-schema.json"
	// DefaultPlatform is the current platform of the host machine
	DefaultPlatform = version.Platform(runtime.GOOS + "/" + runtime.GOARCH)
)

Variables

View Source
var (
	// DefaultConfigHome is the default text for GlobalOpts.ConfigHome
	DefaultConfigHome = "${HOME}/.config/func-e"
	// DefaultDataHome is the default text for GlobalOpts.DataHome
	DefaultDataHome = "${HOME}/.local/share/func-e"
	// DefaultStateHome is the default text for GlobalOpts.StateHome
	DefaultStateHome = "${HOME}/.local/state/func-e"
	// DefaultRuntimeDir is the default text for GlobalOpts.RuntimeDir
	DefaultRuntimeDir = "/tmp/func-e-${UID}"
)

Functions

This section is empty.

Types

type GlobalOpts

type GlobalOpts struct {
	// RunOpts are inlined to allow tests to override parameters without changing ENV variables or flags
	RunOpts
	// Version is the version of the CLI, used in help statements and HTTP requests via "User-Agent".
	// Override this via "-X main.version=XXX"
	Version string
	// EnvoyVersionsURL is the path to the envoy-versions.json. Defaults to DefaultEnvoyVersionsURL
	EnvoyVersionsURL string
	// EnvoyVersion is the default version of Envoy to run. Defaults to the contents of "$ConfigHome/envoy-version".
	// When that file is missing, it is generated from ".latestVersion" from the EnvoyVersionsURL. Its
	// value can be in full version major.minor.patch format, e.g. 1.18.1 or without patch component,
	// major.minor, e.g. 1.18.
	EnvoyVersion version.PatchVersion
	// ConfigHome is the directory containing configuration files. Defaults to DefaultConfigHome
	ConfigHome string
	// DataHome is the directory containing Envoy binaries. Defaults to DefaultDataHome
	DataHome string
	// StateHome is the directory containing persistent state like logs. Defaults to DefaultStateHome
	StateHome string
	// RuntimeDir is the directory for ephemeral runtime files. Defaults to DefaultRuntimeDir
	RuntimeDir string
	// HomeDir is the deprecated FUNC_E_HOME directory. When set, legacy paths are used.
	HomeDir string
	// Quiet means don't Logf to Out
	Quiet bool
	// Out is where status messages are written. Defaults to os.Stdout
	Out io.Writer
	// The platform to target for the Envoy install.
	Platform version.Platform
	// GetEnvoyVersions returns Envoy release versions from EnvoyVersionsURL.
	GetEnvoyVersions version.GetReleaseVersions
}

GlobalOpts represents options that affect more than one func-e commands.

Fields representing non-hidden flags have values set according to the following rules:

  1. value that precedes flag parsing, used in tests
  2. to a value of the command line argument, e.g. `--home-dir`
  3. optional mapping to an environment variable, e.g. `FUNC_E_HOME` (not all flags are mapped to ENV)
  4. otherwise, to the default value, e.g. DefaultDataHome

func (*GlobalOpts) EnvoyRunDir added in v1.3.0

func (o *GlobalOpts) EnvoyRunDir(runID string) string

EnvoyRunDir returns the directory for a specific run (logs, config_dump.json, etc.). Legacy: "$stateHome/runs/{runID}" Default: "$stateHome/envoy-runs/{runID}"

func (*GlobalOpts) EnvoyRuntimeDir added in v1.3.0

func (o *GlobalOpts) EnvoyRuntimeDir(runID string) string

EnvoyRuntimeDir returns the directory for temporary files of a specific run. Legacy: "$runtimeDir/runs/{runID}" Default: "$runtimeDir/{runID}"

func (*GlobalOpts) EnvoyVersionFile added in v1.3.0

func (o *GlobalOpts) EnvoyVersionFile() string

EnvoyVersionFile returns the path to the selected version file. Legacy: "$homeDir/version" Default: "$configHome/envoy-version"

func (*GlobalOpts) EnvoyVersionFileSource added in v1.3.0

func (o *GlobalOpts) EnvoyVersionFileSource() string

EnvoyVersionFileSource returns the display string for the version file source. This is used in help text and command output. Legacy: "$FUNC_E_HOME/version" Default: "$FUNC_E_CONFIG_HOME/envoy-version"

func (*GlobalOpts) EnvoyVersionsDir added in v1.3.0

func (o *GlobalOpts) EnvoyVersionsDir() string

EnvoyVersionsDir returns the directory containing Envoy binaries. Legacy: "$dataHome/versions" Default: "$dataHome/envoy-versions"

func (*GlobalOpts) GenerateRunID added in v1.3.0

func (o *GlobalOpts) GenerateRunID(t time.Time) string

GenerateRunID creates a unique run identifier. Legacy: epoch nanoseconds "1760229853109700000" Default: "20251012_143053_700" (YYYYMMDD_HHMMSS_UUU)

func (*GlobalOpts) Logf added in v0.7.0

func (o *GlobalOpts) Logf(format string, a ...interface{})

Logf is used for shared functions that log conditionally on GlobalOpts.Quiet

func (*GlobalOpts) Mkdirs added in v1.3.0

func (o *GlobalOpts) Mkdirs() error

Mkdirs creates XDG Base Directory directories needed by func-e. Only creates directories that will actually be used: - ConfigHome and DataHome are always created (for version files and binaries) - Per-run directories are only created when RunDir is set (intermediate dirs created automatically) Permissions follow XDG spec: RuntimeDir uses 0700, others use 0750.

type RunOpts

type RunOpts struct {
	// EnvoyPath is the exec.Cmd path to "envoy". Defaults to "$DataHome/envoy-versions/$version/bin/envoy"
	EnvoyPath string
	// EnvoyOut is where to write Envoy's stdout.
	EnvoyOut io.Writer
	// EnvoyErr is where to write Envoy's stderr.
	EnvoyErr io.Writer
	// RunDir is the per-run directory for logs. Generated from StateHome + runID.
	RunDir string
	// TempDir is the per-run directory for ephemeral files. Generated from RuntimeDir + runID.
	TempDir string
	// RunID is the unique identifier for this run. Used in RunDir and TempDir paths.
	RunID string
	// StartupHook is an experimental hook that runs after Envoy starts.
	StartupHook admin.StartupHook
}

RunOpts support invocations of "func-e run"

Jump to

Keyboard shortcuts

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