config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config handles reading and writing the align configuration at ~/.align/config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir() error

CreateDir creates the ~/.align config directory, including any missing parents.

func DirExists

func DirExists() (bool, error)

DirExists reports whether the ~/.align config directory exists.

func FileExists

func FileExists() (bool, error)

FileExists reports whether the ~/.align/config file exists.

func FilePath added in v0.0.6

func FilePath() (string, error)

FilePath returns the default configuration file path.

Types

type Config

type Config struct {
	Github *GithubHost `yaml:"github.com"`
}

Config holds the top-level align configuration read from ~/.align/config.

func New

func New(tkn string) *Config

New returns a Config with the given GitHub token and default rate limits.

func ParseFromFile

func ParseFromFile() (*Config, error)

ParseFromFile reads ~/.align/config, creating the config directory if absent.

func ReadFile added in v0.0.6

func ReadFile(path string) (*Config, error)

ReadFile reads a config file, creating its parent directory if absent.

func (*Config) WithDefaults added in v0.0.6

func (c *Config) WithDefaults() *Config

WithDefaults returns an independent copy with missing GitHub settings initialized.

func (*Config) WriteFile

func (c *Config) WriteFile() error

WriteFile marshals and writes the config to ~/.align/config.

func (*Config) WriteFileAt added in v0.0.6

func (c *Config) WriteFileAt(path string) error

WriteFileAt marshals and writes the config at path.

type GithubHost

type GithubHost struct {
	Token          string  `yaml:"token"`
	Username       string  `yaml:"username"`
	PrivateKey     string  `yaml:"private_key"`
	PrivateKeyFile string  `yaml:"private_key_file"`
	Limits         *Limits `yaml:"limits"`
}

GithubHost holds authentication and rate-limit settings for a GitHub host.

type Limits

type Limits struct {
	RequestsPerSecond int `yaml:"request_per_second"`
	Burst             int `yaml:"burst"`
}

Limits configures GitHub API client request rates.

Jump to

Keyboard shortcuts

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