Documentation
¶
Index ¶
- Constants
- Variables
- func AppendAllowDNS(projectConfigPath string, entries []string) error
- func AppendAllowHTTP(projectConfigPath string, entries []string) error
- func DefaultGlobalPath() string
- func DefaultProjectPath(projectRoot string) string
- func DetectPresets(projectDir string) []string
- func FindProjectRoot(path string) (string, error)
- func MavenSettings(host string, port int) []byte
- func ParseMemoryLimit(memory string) (int64, error)
- func RandomProxyPort(excluded []int) (int, error)
- func RunFirstTimeSetup(projectDir, projectConfigPath string) ([]string, error)
- func RunReconfigure(projectConfigPath, projectDir string) ([]string, error)
- type Config
- type GlobalConfig
- type MergedConfig
- type ProjectConfig
Constants ¶
const ( RuntimeDirName = "vibepit" CacheDirName = "vibepit" ConfigDirName = "vibepit" ProjectConfigDirName = ".vibepit" )
const ( MemorySourceCLI = "--memory flag" MemorySourceProject = "project config" MemorySourceGlobal = "global config" )
Sources of the memory limit, as reported by MemoryLimit.
Variables ¶
var CommitID = "HEAD"
var Version = "0.0.0"
Functions ¶
func AppendAllowDNS ¶
AppendAllowDNS adds entries to the allow-dns list of an existing project config. It loads the current config, deduplicates, and writes back.
func AppendAllowHTTP ¶
AppendAllowHTTP adds entries to the allow-http list of an existing project config. It loads the current config, deduplicates, and writes back.
func DefaultGlobalPath ¶
func DefaultGlobalPath() string
func DefaultProjectPath ¶
func DetectPresets ¶
DetectPresets scans the project root for marker files and returns the names of presets that match. Only presets with Matchers are considered.
func FindProjectRoot ¶
FindProjectRoot returns the Git repository root for the given path, or the path itself if it is not inside a Git repository.
func MavenSettings ¶
func ParseMemoryLimit ¶ added in v0.5.0
ParseMemoryLimit parses a docker-style memory size (e.g. "512m", "8g") into bytes. Empty and a zero size ("0", "0g", ...) both mean no limit and return 0.
func RandomProxyPort ¶
RandomProxyPort returns a random port in the ephemeral range (49152-65535) that is not in the excluded set.
func RunFirstTimeSetup ¶
RunFirstTimeSetup shows an interactive preset selector and writes the project config file. Returns the selected preset names.
func RunReconfigure ¶
RunReconfigure re-runs the interactive preset selector and rewrites only the presets section of the project config. Every other key (allow-http, allow-dns, allow-host-ports, memory, ...) and all comments are left as they are, so settings the template writer doesn't know about survive.
Types ¶
type Config ¶
type Config struct {
Global GlobalConfig
Project ProjectConfig
}
func (*Config) MemoryLimit ¶ added in v0.5.0
MemoryLimit returns the sandbox memory limit in bytes, or 0 for no limit, along with the source the value came from ("" when unset). The CLI value takes precedence over project config, which takes precedence over global config. An explicit "0" at any level disables a limit set at a lower-precedence level.
type GlobalConfig ¶
type GlobalConfig struct {
AllowHTTP []string `koanf:"allow-http"`
AllowDNS []string `koanf:"allow-dns"`
BlockCIDR []string `koanf:"block-cidr"`
AllowCIDR []string `koanf:"allow-cidr"`
ExtraHosts []string `koanf:"extra-hosts"`
UpstreamDNS string `koanf:"upstream-dns"`
Memory string `koanf:"memory"`
}
type MergedConfig ¶
type MergedConfig struct {
AllowHTTP []string `json:"allow-http"`
AllowDNS []string `json:"allow-dns"`
BlockCIDR []string `json:"block-cidr"`
AllowCIDR []string `json:"allow-cidr"`
ExtraHosts []string `json:"extra-hosts,omitempty"`
UpstreamDNS string `json:"upstream-dns,omitempty"`
AllowHostPorts []int `json:"allow-host-ports"`
ProxyIP string `json:"proxy-ip,omitempty"`
HostGateway string `json:"host-gateway,omitempty"`
ProxyPort int `json:"proxy-port,omitempty"`
ControlAPIPort int `json:"control-api-port,omitempty"`
SSHForwardAddr string `json:"ssh-forward-addr,omitempty"`
}