envconfig

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableMetrics = Bool("DISABLE_METRICS")

DisableMetrics is true when DISABLE_METRICS is set to a truthy value (e.g. "1").

View Source
var DisableServerUpdate = Bool("DISABLE_SERVER_UPDATE")

DisableServerUpdate is true when DISABLE_SERVER_UPDATE is set to a truthy value.

View Source
var TLSAutoCert = BoolWithDefault("MODEL_RUNNER_TLS_AUTO_CERT")

TLSAutoCert is true (default) unless MODEL_RUNNER_TLS_AUTO_CERT is set to a falsy value. Call as TLSAutoCert(true) to get the default-true behaviour.

View Source
var TLSEnabled = Bool("MODEL_RUNNER_TLS_ENABLED")

TLSEnabled is true when MODEL_RUNNER_TLS_ENABLED is set to a truthy value.

Functions

func AllowedOrigins

func AllowedOrigins() (origins []string)

AllowedOrigins returns a list of CORS-allowed origins. It reads DMR_ORIGINS and always appends default localhost/127.0.0.1/0.0.0.0 entries on http and https with wildcard ports.

func AsMap

func AsMap() map[string]EnvVar

AsMap returns a map of all model-runner environment variables with their current values and descriptions. Useful for introspection and documentation.

func Bool

func Bool(key string) func() bool

Bool returns a lazy bool accessor that defaults to false when the variable is unset.

func BoolWithDefault

func BoolWithDefault(key string) func(defaultValue bool) bool

BoolWithDefault returns a lazy bool accessor for the given environment variable, allowing a caller-specified default. If the variable is set but cannot be parsed as a bool, the defaultValue is returned.

func DiffusersServerPath

func DiffusersServerPath() string

DiffusersServerPath returns the optional path to the Diffusers server binary. Configured via DIFFUSERS_SERVER_PATH.

func LlamaArgs

func LlamaArgs() string

LlamaArgs returns custom arguments to pass to the llama.cpp server. Configured via LLAMA_ARGS.

func LlamaServerPath

func LlamaServerPath() string

LlamaServerPath returns the path to the llama.cpp server binary. Configured via LLAMA_SERVER_PATH; defaults to the Docker Desktop bundle location.

func LlamaServerVersion

func LlamaServerVersion() string

LlamaServerVersion returns a specific llama.cpp server version to pin. Configured via LLAMA_SERVER_VERSION; empty string means use the bundled version.

func LogLevel

func LogLevel() slog.Level

LogLevel reads LOG_LEVEL and returns the corresponding slog.Level.

func MLXServerPath

func MLXServerPath() string

MLXServerPath returns the optional path to the MLX server binary. Configured via MLX_SERVER_PATH.

func ModelsPath

func ModelsPath() (string, error)

ModelsPath returns the directory where models are stored. Configured via MODELS_PATH; defaults to ~/.docker/models.

func SGLangServerPath

func SGLangServerPath() string

SGLangServerPath returns the optional path to the SGLang server binary. Configured via SGLANG_SERVER_PATH.

func SocketPath

func SocketPath() string

SocketPath returns the Unix socket path for the model runner. Configured via MODEL_RUNNER_SOCK; defaults to "model-runner.sock".

func String

func String(key string) func() string

String returns a lazy string accessor for the given environment variable.

func TCPPort

func TCPPort() string

TCPPort returns the optional TCP port for the model runner HTTP server. Configured via MODEL_RUNNER_PORT; empty string means use Unix socket.

func TLSCert

func TLSCert() string

TLSCert returns the path to the TLS certificate file. Configured via MODEL_RUNNER_TLS_CERT.

func TLSKey

func TLSKey() string

TLSKey returns the path to the TLS private key file. Configured via MODEL_RUNNER_TLS_KEY.

func TLSPort

func TLSPort() string

TLSPort returns the TLS listener port. Configured via MODEL_RUNNER_TLS_PORT; defaults to "12444".

func VLLMMetalServerPath

func VLLMMetalServerPath() string

VLLMMetalServerPath returns the optional path to the vLLM Metal server binary. Configured via VLLM_METAL_SERVER_PATH.

func VLLMServerPath

func VLLMServerPath() string

VLLMServerPath returns the optional path to the vLLM server binary. Configured via VLLM_SERVER_PATH.

func Var

func Var(key string) string

Var returns an environment variable stripped of leading/trailing quotes and spaces.

Types

type EnvVar

type EnvVar struct {
	Name        string
	Value       any
	Description string
}

EnvVar describes a single environment variable with its current value and a human-readable description.

Jump to

Keyboard shortcuts

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