config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextOptionSSHAddPrivateKeys          = "SSH_ADD_PRIVATE_KEYS"
	ContextOptionGPGAgentForwarding         = "GPG_AGENT_FORWARDING"
	ContextOptionGitSSHSignatureForwarding  = "GIT_SSH_SIGNATURE_FORWARDING"
	ContextOptionSSHInjectDockerCredentials = "SSH_INJECT_DOCKER_CREDENTIALS"
	ContextOptionSSHInjectGitCredentials    = "SSH_INJECT_GIT_CREDENTIALS"
	ContextOptionExitAfterTimeout           = "EXIT_AFTER_TIMEOUT"
	ContextOptionTelemetry                  = "TELEMETRY"
	ContextOptionAgentURL                   = "AGENT_URL"
	ContextOptionDotfilesURL                = "DOTFILES_URL"
	ContextOptionDotfilesScript             = "DOTFILES_SCRIPT"
	ContextOptionSSHAgentForwarding         = "SSH_AGENT_FORWARDING"
	ContextOptionSSHConfigPath              = "SSH_CONFIG_PATH"
	ContextOptionSSHConfigIncludePath       = "SSH_CONFIG_INCLUDE_PATH"
	ContextOptionAgentInjectTimeout         = "AGENT_INJECT_TIMEOUT"
	ContextOptionRegistryCache              = "REGISTRY_CACHE"
	ContextOptionSSHStrictHostKeyChecking   = "SSH_STRICT_HOST_KEY_CHECKING"
)
View Source
const (
	BoolTrue  = "true"
	BoolFalse = "false"
)

BoolTrue and BoolFalse are the string representations used for boolean configuration values throughout the application (env vars, options, agent config).

View Source
const (
	// EnvBinaryPath is set to the path of the DevPod binary.
	EnvBinaryPath = "DEVPOD"

	// EnvHome overrides the default DevPod home directory.
	EnvHome = "DEVPOD_HOME"

	// EnvConfig overrides the default config file path.
	EnvConfig = "DEVPOD_CONFIG"

	// EnvUI indicates the desktop UI is active.
	EnvUI = "DEVPOD_UI"

	// EnvDebug enables debug logging.
	EnvDebug = "DEVPOD_DEBUG"

	// EnvDisableTelemetry disables telemetry collection.
	EnvDisableTelemetry = "DEVPOD_DISABLE_TELEMETRY"

	// EnvAgentURL overrides the agent download URL.
	EnvAgentURL = "DEVPOD_AGENT_URL"

	// EnvAgentPreferDownload forces agent binary download even if a local copy exists.
	EnvAgentPreferDownload = "DEVPOD_AGENT_PREFER_DOWNLOAD"

	// EnvOS is set to the host operating system (runtime.GOOS).
	EnvOS = "DEVPOD_OS"

	// EnvArch is set to the host architecture (runtime.GOARCH).
	EnvArch = "DEVPOD_ARCH"

	// EnvLogLevel is set to the current log level.
	EnvLogLevel = "DEVPOD_LOG_LEVEL"

	// EnvWorkspaceID is the current workspace identifier.
	EnvWorkspaceID = "DEVPOD_WORKSPACE_ID"

	// EnvWorkspaceUID is the current workspace unique identifier.
	EnvWorkspaceUID = "DEVPOD_WORKSPACE_UID"

	// EnvWorkspaceDaemonConfig holds the workspace daemon configuration.
	EnvWorkspaceDaemonConfig = "DEVPOD_WORKSPACE_DAEMON_CONFIG"

	// EnvWorkspaceCredentialsPort is the workspace credentials server port.
	EnvWorkspaceCredentialsPort = "DEVPOD_WORKSPACE_CREDENTIALS_PORT" // #nosec G101

	// EnvCredentialsServerPort is the credentials server port on the host side.
	EnvCredentialsServerPort = "DEVPOD_CREDENTIALS_SERVER_PORT" // #nosec G101

	// EnvGitHelperPort is the git credential helper forwarding port.
	EnvGitHelperPort = "DEVPOD_GIT_HELPER_PORT"

	// EnvCraneName overrides the crane binary name.
	EnvCraneName = "DEVPOD_CRANE_NAME"

	// EnvPlatformOptions holds serialized platform options.
	EnvPlatformOptions = "DEVPOD_PLATFORM_OPTIONS"

	// EnvFlagsUp holds extra flags for the up command.
	EnvFlagsUp = "DEVPOD_FLAGS_UP"

	// EnvFlagsSSH holds extra flags for the ssh command.
	EnvFlagsSSH = "DEVPOD_FLAGS_SSH"

	// EnvFlagsDelete holds extra flags for the delete command.
	EnvFlagsDelete = "DEVPOD_FLAGS_DELETE"

	// EnvFlagsStatus holds extra flags for the status command.
	EnvFlagsStatus = "DEVPOD_FLAGS_STATUS"

	// EnvSubdomain is the subdomain configuration for DevPod Pro.
	EnvSubdomain = "DEVPOD_SUBDOMAIN"

	// EnvPrefix is the base prefix for all DevPod environment variables.
	EnvPrefix = "DEVPOD_"

	// EnvIDEPrefix is the prefix for IDE-specific option env vars (append IDE name + "_").
	EnvIDEPrefix = EnvPrefix + "IDE_"

	// EnvProviderPrefix is the prefix for provider-specific option env vars (append provider name + "_").
	EnvProviderPrefix = EnvPrefix + "PROVIDER_"

	// EnvProviderWorkspaceID is the workspace identifier passed to providers.
	EnvProviderWorkspaceID = "WORKSPACE_ID"

	// EnvProviderWorkspaceUID is the workspace UID passed to providers.
	EnvProviderWorkspaceUID = "WORKSPACE_UID"

	// EnvProviderWorkspacePicture is the workspace picture URL passed to providers.
	EnvProviderWorkspacePicture = "WORKSPACE_PICTURE"

	// EnvProviderWorkspaceFolder is the workspace folder path passed to providers.
	EnvProviderWorkspaceFolder = "WORKSPACE_FOLDER"

	// EnvProviderWorkspaceContext is the workspace context passed to providers.
	EnvProviderWorkspaceContext = "WORKSPACE_CONTEXT"

	// EnvProviderWorkspaceOrigin is the workspace origin passed to providers.
	EnvProviderWorkspaceOrigin = "WORKSPACE_ORIGIN"

	// EnvProviderWorkspaceSource is the workspace source passed to providers.
	EnvProviderWorkspaceSource = "WORKSPACE_SOURCE"

	// EnvProviderWorkspaceProvider is the workspace provider name passed to providers.
	EnvProviderWorkspaceProvider = "WORKSPACE_PROVIDER"

	// EnvProviderMachineID is the machine identifier passed to providers.
	EnvProviderMachineID = "MACHINE_ID"

	// EnvProviderMachineContext is the machine context passed to providers.
	EnvProviderMachineContext = "MACHINE_CONTEXT"

	// EnvProviderMachineFolder is the machine folder path passed to providers.
	EnvProviderMachineFolder = "MACHINE_FOLDER"

	// EnvProviderMachineProvider is the machine provider name passed to providers.
	EnvProviderMachineProvider = "MACHINE_PROVIDER"

	// EnvProviderID is the provider identifier passed to providers.
	EnvProviderID = "PROVIDER_ID"

	// EnvProviderContext is the provider context passed to providers.
	EnvProviderContext = "PROVIDER_CONTEXT"

	// EnvProviderFolder is the provider folder path passed to providers.
	EnvProviderFolder = "PROVIDER_FOLDER"

	// EnvLoftProject is the Loft project name for pro features.
	EnvLoftProject = "LOFT_PROJECT"

	// EnvLoftFilterByOwner enables filtering by owner in Loft.
	EnvLoftFilterByOwner = "LOFT_FILTER_BY_OWNER"

	// EnvDevcontainerID is the devcontainer identifier.
	EnvDevcontainerID = "DEVCONTAINER_ID"
)

Environment variable constants used throughout the application. All constants follow the EnvXxx naming convention.

View Source
const (
	// IgnoreFileName is the name of the devpod ignore file.
	IgnoreFileName = "." + BinaryName + "ignore"

	// SSHSignatureHelperPath is the path to the SSH signature helper script.
	SSHSignatureHelperPath = "/usr/local/bin/" + BinaryName + "-ssh-signature"

	// SSHSignatureHelperName is the name used in git config for the SSH signature program.
	SSHSignatureHelperName = BinaryName + "-ssh-signature"

	// DockerCredentialHelperName is the docker credential helper binary name.
	DockerCredentialHelperName = "docker-credential-" + BinaryName

	// DevContainerResultPath is where devcontainer results are written.
	DevContainerResultPath = "/var/run/" + BinaryName + "/result.json"
)
View Source
const (
	// ProductName is the display name for the product.
	ProductName = "DevPod"

	// ProductNamePro is the display name for the Pro product.
	ProductNamePro = ProductName + " Pro"

	// DaemonServiceDescription is the system daemon service description.
	DaemonServiceDescription = ProductName + " Agent Service"
)
View Source
const (
	RepoOwner         = "skevetter"
	RepoName          = "devpod"
	RepoSlug          = RepoOwner + "/" + RepoName
	GitHubRepoURL     = "https://github.com/" + RepoSlug
	GitHubReleasesURL = GitHubRepoURL + "/releases"
	GitHubAPIUserURL  = "https://api.github.com/users/" + RepoOwner
	ProviderPrefix    = RepoName + "-provider-"

	// ProReleaseName is the Helm release / product name for DevPod Pro.
	ProReleaseName = RepoName + "-pro"

	// BinaryName is the CLI binary base name used in downloads and SSH host suffixes.
	BinaryName = RepoName

	// SSHHostSuffix is appended to workspace IDs for SSH config host entries.
	SSHHostSuffix = "." + BinaryName

	// WebsiteBaseURL is the project website used for asset URLs.
	WebsiteBaseURL = "https://" + RepoName + ".sh"

	// WebsiteAssetsURL is the base URL for icon/image assets.
	WebsiteAssetsURL = WebsiteBaseURL + "/assets"
)
View Source
const ConfigDirName = "." + RepoName

ConfigDirName is the hidden directory name used for DevPod configuration.

View Source
const DefaultContext = "default"

Variables

View Source
var ConfigFile = "config.yaml"
View Source
var ContextOptions = []ContextOption{
	{
		Name:        ContextOptionSSHAddPrivateKeys,
		Description: "Specifies if DevPod should automatically add ssh-keys to the ssh-agent",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionExitAfterTimeout,
		Description: "Specifies if DevPod should exit the process after the browser has been idle for a minute",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionGPGAgentForwarding,
		Description: "Specifies if DevPod should do gpg-agent forwarding by default for ssh",
		Default:     "false",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionGitSSHSignatureForwarding,
		Description: "Specifies if DevPod should automatically detect ssh signature git setting and inject ssh signature helper",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionSSHInjectDockerCredentials,
		Description: "Specifies if DevPod should inject docker credentials into the workspace",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionSSHInjectGitCredentials,
		Description: "Specifies if DevPod should inject git credentials into the workspace",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionSSHAgentForwarding,
		Description: "Specifies if DevPod should do agent forwarding by default into the workspace",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionTelemetry,
		Description: "Specifies if DevPod should send telemetry information",
		Default:     "true",
		Enum:        []string{"true", "false"},
	},
	{
		Name:        ContextOptionAgentURL,
		Description: "Specifies the agent url to use for DevPod",
	},
	{
		Name:        ContextOptionDotfilesURL,
		Description: "Specifies the dotfiles repo url to use for DevPod",
	},
	{
		Name:        ContextOptionDotfilesScript,
		Description: "Specifies the script to run after cloning dotfiles repo to install them",
	},
	{
		Name:        ContextOptionSSHConfigPath,
		Description: "Specifies the path where the ssh config should be written to",
	},
	{
		Name:        ContextOptionSSHConfigIncludePath,
		Description: "Specifies an alternate path where DevPod host entries should be written. Use this when your main SSH config is read-only (e.g., managed by Nix). Your main SSH config should have an Include directive pointing to this file.",
	},
	{
		Name:        ContextOptionAgentInjectTimeout,
		Description: "Specifies the timeout to inject the agent",
		Default:     "20",
	},
	{
		Name:        ContextOptionRegistryCache,
		Description: "Specifies the registry to use as a build cache, e.g. gcr.io/my-project/my-dev-env",
		Default:     "",
	},
	{
		Name:        ContextOptionSSHStrictHostKeyChecking,
		Description: "Enables strict ssh host key checking for all operations",
		Default:     "false",
		Enum:        []string{"true", "false"},
	},
}

Functions

func GetConfigDir

func GetConfigDir() (string, error)

func GetConfigPath

func GetConfigPath() (string, error)

func MergeContextOptions

func MergeContextOptions(contextConfig *ContextConfig, environ []string)

func ParseTimeOption

func ParseTimeOption(cfg *Config, opt string) time.Duration

func SaveConfig

func SaveConfig(config *Config) error

Types

type Config

type Config struct {
	// DefaultContext is the default context to use. Defaults to "default"
	DefaultContext string `json:"defaultContext,omitempty"`

	// Contexts holds the config contexts
	Contexts map[string]*ContextConfig `json:"contexts,omitempty"`

	// Origin holds the path where this config was loaded from
	Origin string `json:"-"`

	// OriginalContext is the original default context
	OriginalContext string `json:"-"`
}

func CloneConfig

func CloneConfig(config *Config) *Config

func LoadConfig

func LoadConfig(contextOverride string, providerOverride string) (*Config, error)

func (*Config) ContextOption

func (c *Config) ContextOption(option string) string

func (*Config) Current

func (c *Config) Current() *ContextConfig

func (*Config) DynamicProviderOptionDefinitions

func (c *Config) DynamicProviderOptionDefinitions(provider string) OptionDefinitions

func (*Config) IDEOptions

func (c *Config) IDEOptions(ide string) map[string]OptionValue

func (*Config) ProviderOptions

func (c *Config) ProviderOptions(provider string) map[string]OptionValue

type ContextConfig

type ContextConfig struct {
	// DefaultProvider is the default provider to use
	DefaultProvider string `json:"defaultProvider,omitempty"`

	// DefaultIDE holds default ide configuration
	DefaultIDE string `json:"defaultIde,omitempty"`

	// Options are additional context options
	Options map[string]OptionValue `json:"options,omitempty"`

	// IDEs holds the ide configuration
	IDEs map[string]*IDEConfig `json:"ides,omitempty"`

	// Providers holds the provider configuration
	Providers map[string]*ProviderConfig `json:"providers,omitempty"`

	// OriginalProvider is the original default provider
	OriginalProvider string `json:"-"`
}

func (*ContextConfig) DynamicProviderOptionDefinitions

func (c *ContextConfig) DynamicProviderOptionDefinitions(provider string) OptionDefinitions

func (*ContextConfig) IDEOptions

func (c *ContextConfig) IDEOptions(ide string) map[string]OptionValue

func (*ContextConfig) IsSingleMachine

func (c *ContextConfig) IsSingleMachine(provider string) bool

func (*ContextConfig) ProviderOptions

func (c *ContextConfig) ProviderOptions(provider string) map[string]OptionValue

type ContextOption

type ContextOption struct {
	// Name of the context option
	Name string `json:"name,omitempty"`

	// Description is the description of the context option
	Description string `json:"description,omitempty"`

	// Default is the default value of the context option
	Default string `json:"default,omitempty"`

	// Enum of the allowed values
	Enum []string `json:"enum,omitempty"`
}

type IDE

type IDE string
const (
	IDENone            IDE = "none"
	IDEVSCode          IDE = "vscode"
	IDEVSCodeInsiders  IDE = "vscode-insiders"
	IDEOpenVSCode      IDE = "openvscode"
	IDEIntellij        IDE = "intellij"
	IDEGoland          IDE = "goland"
	IDERustRover       IDE = "rustrover"
	IDEPyCharm         IDE = "pycharm"
	IDEPhpStorm        IDE = "phpstorm"
	IDECLion           IDE = "clion"
	IDERubyMine        IDE = "rubymine"
	IDERider           IDE = "rider"
	IDEWebStorm        IDE = "webstorm"
	IDEDataSpell       IDE = "dataspell"
	IDEFleet           IDE = "fleet"
	IDEJupyterNotebook IDE = "jupyternotebook"
	IDECursor          IDE = "cursor"
	IDEPositron        IDE = "positron"
	IDECodium          IDE = "codium"
	IDEZed             IDE = "zed"
	IDERStudio         IDE = "rstudio"
	IDEWindsurf        IDE = "windsurf"
	IDEAntigravity     IDE = "antigravity"
	IDEBob             IDE = "bob"
)

type IDEConfig

type IDEConfig struct {
	// Options are additional ide options
	Options map[string]OptionValue `json:"options,omitempty"`
}

type IDEGroup

type IDEGroup string
const (
	IDEGroupPrimary   IDEGroup = "Primary"
	IDEGroupJetBrains IDEGroup = "JetBrains"
	IDEGroupOther     IDEGroup = "Other"
)

type OptionDefinitions

type OptionDefinitions = map[string]*types.Option

type OptionValue

type OptionValue struct {
	// Value is the value of the option
	Value string `json:"value,omitempty"`

	// UserProvided signals that this value was user provided
	UserProvided bool `json:"userProvided,omitempty"`

	// Filled is the time when this value was filled
	Filled *types.Time `json:"filled,omitempty"`

	// Children are the child options
	Children []string `json:"children,omitempty"`
}

type ProviderConfig

type ProviderConfig struct {
	// Initialized holds if the provider was initialized correctly.
	Initialized bool `json:"initialized,omitempty"`

	// SingleMachine signals DevPod if a single machine should be used for this provider.
	SingleMachine bool `json:"singleMachine,omitempty"`

	// Options are the configured provider options
	Options map[string]OptionValue `json:"options,omitempty"`

	// DynamicOptions are the unresolved dynamic provider options
	DynamicOptions OptionDefinitions `json:"dynamicOptions,omitempty"`

	// CreationTimestamp is the timestamp when this provider was added
	CreationTimestamp types.Time `json:"creationTimestamp"`
}

Jump to

Keyboard shortcuts

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