config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeDirName       = "vibepit"
	CacheDirName         = "vibepit"
	ConfigDirName        = "vibepit"
	ProjectConfigDirName = ".vibepit"
)

Variables

View Source
var CommitID = "HEAD"
View Source
var Version = "0.0.0"

Functions

func AppendAllowDNS

func AppendAllowDNS(projectConfigPath string, entries []string) error

AppendAllowDNS adds entries to the allow-dns list of an existing project config. It loads the current config, deduplicates, and writes back.

func AppendAllowHTTP

func AppendAllowHTTP(projectConfigPath string, entries []string) error

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 DefaultProjectPath(projectRoot string) string

func DetectPresets

func DetectPresets(projectDir string) []string

DetectPresets scans the project root for marker files and returns the names of presets that match. Only presets with Matchers are considered.

func FindProjectRoot

func FindProjectRoot(path string) (string, error)

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 MavenSettings(host string, port int) []byte

func RandomProxyPort

func RandomProxyPort(excluded []int) (int, error)

RandomProxyPort returns a random port in the ephemeral range (49152-65535) that is not in the excluded set.

func RunFirstTimeSetup

func RunFirstTimeSetup(projectDir, projectConfigPath string) ([]string, error)

RunFirstTimeSetup shows an interactive preset selector and writes the project config file. Returns the selected preset names.

func RunReconfigure

func RunReconfigure(projectConfigPath, projectDir string) ([]string, error)

RunReconfigure re-runs the interactive preset selector, preserving existing allow-http and allow-dns entries from the project config.

Types

type Config

type Config struct {
	Global  GlobalConfig
	Project ProjectConfig
}

func Load

func Load(globalPath, projectPath string) (*Config, error)

func (*Config) Merge

func (c *Config) Merge(cliAllow []string, cliPresets []string) (MergedConfig, error)

Merge combines global config, project config, CLI flags, and expanded presets into a single flat config. Duplicates are removed while preserving order.

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

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

type ProjectConfig

type ProjectConfig struct {
	Presets        []string `koanf:"presets"`
	AllowHTTP      []string `koanf:"allow-http"`
	AllowDNS       []string `koanf:"allow-dns"`
	AllowHostPorts []int    `koanf:"allow-host-ports"`
}

Jump to

Keyboard shortcuts

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