config

package
v0.0.251-pre-2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0 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

Index

Constants

View Source
const (
	// FileName denotes the name of the config file.
	FileName = "config.yml"
)

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, cfg *Config) context.Context

NewContext derives a Context that carries the given Config from ctx.

Types

type Config

type Config struct {
	APIBaseURL   string `yaml:"-"`
	RegistryHost string `yaml:"-"`

	AccessToken   string `yaml:"access_token"`
	VerboseOutput bool   `yaml:"-"`
	JSONOutput    bool   `yaml:"-"`
	LogGQLErrors  bool   `yaml:"-"`
	Organization  string `yaml:"-"`
	LocalOnly     bool   `yaml:"-"`
}

func FromContext

func FromContext(ctx context.Context) *Config

FromContext returns the Config ctx carries. It panics in case ctx carries no Config.

func New

func New() *Config

New returns a new instance of Config populated with default values.

func (*Config) ApplyEnv

func (cfg *Config) ApplyEnv()

ApplyEnv sets the properties of cfg which may be set via environment variables to the values these variables contain.

func (*Config) ApplyFile

func (cfg *Config) ApplyFile(path string) (err error)

ApplyFile sets the properties of cfg which may be set via configuration file to the values the file at the given path contains.

func (*Config) ApplyFlags

func (cfg *Config) ApplyFlags(fs *pflag.FlagSet)

ApplyFlags sets the properties of cfg which may be set via command line flags to the values the flags of the given FlagSet may contain.

Jump to

Keyboard shortcuts

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