config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProjectConfigPath

func ProjectConfigPath() string

ProjectConfigPath walks up from the current directory looking for a .forge file. Returns empty string if none is found.

func ResetCache

func ResetCache()

ResetCache clears the cached config. Only useful in tests.

func SetDomain

func SetDomain(domain, token, forgeType string) error

SetDomain updates or adds a domain section in the user config file. Creates the config directory if needed. Sets file permissions to 0600 since the file may contain tokens.

func UserConfigPath

func UserConfigPath() string

UserConfigPath returns the path to the user-level config file. It respects XDG_CONFIG_HOME, falling back to ~/.config/forge/config.

Types

type Config

type Config struct {
	Default DefaultSection
	Domains map[string]DomainSection
}

func Load

func Load() (*Config, error)

Load returns the merged config from both user and project config files. The result is cached so the files are parsed at most once per invocation.

type DefaultSection

type DefaultSection struct {
	Output    string // table, json, plain
	ForgeType string // default forge type
}

type DomainSection

type DomainSection struct {
	Type  string // github, gitlab, gitea, forgejo
	Token string // only from user config, never .forge
}

Jump to

Keyboard shortcuts

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