Documentation ¶
Index ¶
- Constants
- Variables
- func OptionNames() []string
- func SaveConfig(w io.Writer, config *Config) error
- type BoolOption
- type Config
- func (c *Config) GitHubHost() string
- func (c *Config) GitHubToken() string
- func (c *Config) GitHubUser() string
- func (c *Config) LogDate() bool
- func (c *Config) LogFlags() int
- func (c *Config) LogLevel() string
- func (c *Config) LogLongFile() bool
- func (c *Config) LogMicroSeconds() bool
- func (c *Config) LogShortFile() bool
- func (c *Config) LogTime() bool
- func (c *Config) LogUTC() bool
- func (c *Config) PrimaryRoot() string
- func (c *Config) Root() []string
- func (c *Config) Stderr() io.Writer
- func (c *Config) Stdin() io.Reader
- func (c *Config) Stdout() io.Writer
- type GitHubConfig
- type LogConfig
- type OptionAccessor
- type PathListOption
Constants ¶
View Source
const ( // DefaultHost is the default host of the GitHub DefaultHost = "github.com" DefaultLogLevel = "warn" )
Variables ¶
View Source
var ( ErrEmptyValue = errors.New("empty value") ErrInvalidOptionName = errors.New("invalid option name") )
View Source
var ( TrueOption = BoolOption("yes") FalseOption = BoolOption("no") EmptyBoolOption = BoolOption("") )
Functions ¶
func OptionNames ¶
func OptionNames() []string
Types ¶
type BoolOption ¶
type BoolOption string
func (BoolOption) Bool ¶
func (c BoolOption) Bool() bool
func (*BoolOption) Decode ¶
func (c *BoolOption) Decode(repl string) error
Decode implements the interface `envdecode.Decoder`
func (BoolOption) MarshalYAML ¶
func (c BoolOption) MarshalYAML() (interface{}, error)
MarshalYAML implements the interface `yaml.Marshaler`
func (BoolOption) String ¶
func (c BoolOption) String() string
func (*BoolOption) UnmarshalYAML ¶
func (c *BoolOption) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the interface `yaml.Unmarshaler`
type Config ¶
type Config struct { context.Context `yaml:"-"` Log LogConfig `yaml:"log,omitempty"` VRoot PathListOption `yaml:"root,omitempty" env:"GOGH_ROOT"` GitHub GitHubConfig `yaml:"github,omitempty"` }
Config holds configuration file values.
func DefaultConfig ¶
func DefaultConfig() *Config
func GetEnvarConfig ¶
func LoadKeyring ¶ added in v1.3.3
func LoadKeyring() *Config
func MergeConfig ¶
func (*Config) GitHubHost ¶
func (*Config) GitHubToken ¶
func (*Config) GitHubUser ¶
func (*Config) LogLongFile ¶
func (*Config) LogMicroSeconds ¶
func (*Config) LogShortFile ¶
func (*Config) PrimaryRoot ¶
type GitHubConfig ¶
type LogConfig ¶
type LogConfig struct { Level string `yaml:"level,omitempty" env:"GOGH_LOG_LEVEL"` Date BoolOption `yaml:"date" env:"GOGH_LOG_DATE"` // the date in the local time zone: 2009/01/23 Time BoolOption `yaml:"time" env:"GOGH_LOG_TIME"` // the time in the local time zone: 01:23:23 MicroSeconds BoolOption `yaml:"microseconds" env:"GOGH_LOG_MICROSECONDS"` // microsecond resolution: 01:23:23.123123. assumes Ltime. LongFile BoolOption `yaml:"longfile" env:"GOGH_LOG_LONGFILE"` // full file name and line number: /a/b/c/d.go:23 ShortFile BoolOption `yaml:"shortfile" env:"GOGH_LOG_SHORTFILE"` // final file name element and line number: d.go:23. overrides Llongfile UTC BoolOption `yaml:"utc" env:"GOGH_LOG_UTC"` // if Ldate or Ltime is set, use UTC rather than the local time zone }
type OptionAccessor ¶
type OptionAccessor struct {
// contains filtered or unexported fields
}
func Option ¶
func Option(optionName string) (*OptionAccessor, error)
func (OptionAccessor) Get ¶
func (a OptionAccessor) Get(cfg *Config) string
func (OptionAccessor) Unset ¶
func (a OptionAccessor) Unset(cfg *Config) error
type PathListOption ¶
type PathListOption []string
func (*PathListOption) Decode ¶
func (c *PathListOption) Decode(repl string) error
Decode implements the interface `envdecode.Decoder`
func (PathListOption) MarshalYAML ¶
func (c PathListOption) MarshalYAML() (interface{}, error)
MarshalYAML implements the interface `yaml.Marshaler`
func (*PathListOption) UnmarshalYAML ¶
func (c *PathListOption) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the interface `yaml.Unmarshaler`
Source Files ¶
Click to show internal directories.
Click to hide internal directories.