config

package
v0.6.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MPL-2.0 Imports: 13 Imported by: 3

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"
	ContextOptionAgentInjectTimeout         = "AGENT_INJECT_TIMEOUT"
	ContextOptionRegistryCache              = "REGISTRY_CACHE"
)
View Source
const DEVPOD_CONFIG = "DEVPOD_CONFIG"

Override config path

View Source
const DEVPOD_HOME = "DEVPOD_HOME"

Override devpod home

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:        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:     "",
	},
}

Functions

func GetConfigDir

func GetConfigDir() (string, error)

func GetConfigPath

func GetConfigPath() (string, error)

func MergeContextOptions added in v0.5.21

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

func ParseTimeOption added in v0.5.20

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 added in v0.3.4

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 added in v0.3.4

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"
	IDEJupyterDesktop  IDE = "jupyterdesktop"
	IDECursor          IDE = "cursor"
	IDEPositron        IDE = "positron"
	IDEMarimo          IDE = "marimo"
	IDECodium          IDE = "codium"
	IDEZed             IDE = "zed"
)

type IDEConfig

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

type OptionDefinitions added in v0.3.4

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,omitempty"`
}

Jump to

Keyboard shortcuts

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