Documentation
¶
Index ¶
- Constants
- type ConfigSource
- type Paths
- func (p *Paths) EnsureDirs() error
- func (p *Paths) FindLegacyConfig() (string, bool)
- func (p *Paths) FindLegacyState() (string, bool)
- func (p *Paths) GetConfigPaths() []string
- func (p *Paths) GetConfigSource(path string) ConfigSource
- func (p *Paths) UserConfigFile() string
- func (p *Paths) UserStateFile(repoOwner, repoName string) string
Constants ¶
const ( // AppName is the application name used in config paths AppName = "rivet" // ConfigFileName is the name of the config file ConfigFileName = "config.yaml" // StateFileName is the name of the state file StateFileName = "state.yaml" // LegacyConfigFileName is the old config file name LegacyConfigFileName = ".rivet.yaml" // LegacyStateFileName is the old state file name LegacyStateFileName = ".rivet.state.yaml" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigSource ¶
type ConfigSource int
ConfigSource indicates where a config file came from
const ( SourceUnknown ConfigSource = iota SourceUserConfig SourceProjectConfig SourceRepoDefault SourceEnvVar SourceCLIFlag )
func (ConfigSource) String ¶
func (s ConfigSource) String() string
type Paths ¶
type Paths struct {
// UserConfigDir is the user's config directory (~/.config/rivet)
UserConfigDir string
// UserStateDir is the user's state directory (~/.local/state/rivet)
UserStateDir string
// UserCacheDir is the user's cache directory (~/.cache/rivet)
UserCacheDir string
// ProjectRoot is the root of the current git repository (if any)
ProjectRoot string
// RepoDefaultConfigPath is the path to the repository's default config (.github/.rivet.yaml)
RepoDefaultConfigPath string
// ProjectUserConfigPath is the path to the user's project-specific config (.git/.rivet/config.yaml)
ProjectUserConfigPath string
// contains filtered or unexported fields
}
Paths provides access to all application paths following XDG Base Directory specification
func NewWithProject ¶
NewWithProject creates a new Paths instance with project-specific paths
func (*Paths) EnsureDirs ¶
EnsureDirs creates all necessary directories if they don't exist. Following XDG Base Directory specification, it: - Attempts to create directories with permission 0700 (as per XDG spec) - Falls back to alternative directories if permission denied - Prints warnings for non-critical directory failures - Only fails if critical directories cannot be created
func (*Paths) FindLegacyConfig ¶
FindLegacyConfig searches for legacy config files in order of precedence Returns the path and whether it exists
func (*Paths) FindLegacyState ¶
FindLegacyState searches for legacy state files
func (*Paths) GetConfigPaths ¶
GetConfigPaths returns all config paths in order of precedence (lowest to highest) The last path in the list has the highest priority
func (*Paths) GetConfigSource ¶
func (p *Paths) GetConfigSource(path string) ConfigSource
GetConfigSource determines which source a config path corresponds to
func (*Paths) UserConfigFile ¶
UserConfigFile returns the path to the user's main config file
func (*Paths) UserStateFile ¶
UserStateFile returns the path to the user's state file for a specific repository