config

package
v0.0.0-...-0d5a216 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDir

func CreateDir() error

CreateDir creates the config directory and all necessary parent directories missing. It returns any error it encounters with creating the directory.

func DirExists

func DirExists() (bool, error)

DirExists returns a bool and error representing whether or not a config directory exists for the current user, and any errors it encounters with statting the existence of the directory.

func FileExists

func FileExists() (bool, error)

FileExists returns a bool and error representing whether or not a config file exists for the current user, and any errors it encounters with statting the existence of the file.

Types

type Config

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

Config represents the config file for align

func New

func New(tkn string) *Config

New takes a token string and creates the most basic config capable of being written.

func ParseFromFile

func ParseFromFile() (*Config, error)

ParseFromFile reads the align config file from the home directory. It returns any errors it encounters with parsing the file.

func (*Config) WriteFile

func (c *Config) WriteFile() error

WriteFile writes the file to the defined location for the current user, and returns any errors encountered doing so.

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 represents a single host for which align has a configuration

type Limits

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

Limits represents a limits override for the client

Jump to

Keyboard shortcuts

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