config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(project, envFilePath, copySource string, vars []Var) string

Generate returns the contents of a fresh .bight.yml.

`copySource`, if non-empty, emits a `copy:` block on the env_file so a freshly-created worktree seeds the dest from that path (resolved against the main worktree root). When empty, a commented `copy:` hint is emitted instead so the option is discoverable later.

Types

type Config

type Config struct {
	Project  string    `yaml:"project"`
	Defaults Defaults  `yaml:"defaults"`
	EnvFiles []EnvFile `yaml:"env_files"`
}

func Load

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

Load discovers and loads config. It returns the loaded config along with the path that was loaded — either the matched repo config filename in the current directory (".bight.yml" or ".bight.yaml") or, if only the global config exists, the global config path.

func LoadFrom

func LoadFrom(repoConfigPath string) (*Config, string, error)

LoadFrom loads config from a specific repo config file path, merging with the global config (~/.bight.yml) as usual. Unlike Load, it does not search for .bight.yml or .bight.yaml in the current directory. The returned path is the repo config path that was loaded.

type Copy added in v0.3.0

type Copy struct {
	Source    string `yaml:"source"`
	Overwrite bool   `yaml:"overwrite"`
}

Copy describes how to seed an env file by copying it from elsewhere. In YAML, copy may be given as either a scalar (the source path, with Overwrite defaulting to false) or a mapping with explicit source and overwrite fields:

copy: ../main/.env
copy: { source: ../main/.env, overwrite: true }

Overwrite controls only the file copy step. Var patching always rewrites the keys it targets regardless of this setting.

func (*Copy) UnmarshalYAML added in v0.3.0

func (c *Copy) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML allows `copy:` to be either a scalar (treated as the source path) or a full mapping with source + overwrite.

type Defaults

type Defaults struct {
	BranchTemplate  string `yaml:"branch_template"`
	CollectComments string `yaml:"collect-comments"`
}

type EnvFile

type EnvFile struct {
	Path   string `yaml:"path"`
	Backup bool   `yaml:"backup"`
	Copy   *Copy  `yaml:"copy"`
	Vars   []Var  `yaml:"vars"`
}

type Var

type Var struct {
	Name      string `yaml:"name"`
	Strategy  string `yaml:"strategy"`
	On        string `yaml:"on"`
	Sensitive bool   `yaml:"sensitive"`
}

Jump to

Keyboard shortcuts

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