config

package
v0.7.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MPL-2.0 Imports: 17 Imported by: 20

Documentation

Overview

Package config implements application-level configuration functionality.

It works by loading configuration sources (e.g. CLI flags, configuration files, local VCS) and providing functions which compute relevant configuration values from these sources.

This design is intended to make how a particular value is computed very clear. All values can have their computation strategy modified independently of all other values. It should also be easy to determine which source set a particular configuration value.

Index

Constants

This section is empty.

Variables

View Source
var ErrFileNotFound = errors.New("no files existed")

Functions

func APIKey added in v0.7.0

func APIKey() string

APIKey is user's FOSSA API key.

func Branch added in v0.7.0

func Branch() string

func Debug added in v0.7.0

func Debug() bool

Debug is true if the user has requested debug-level logging.

func Endpoint added in v0.7.0

func Endpoint() string

Endpoint is the desired FOSSA backend endpoint.

func Fetcher added in v0.7.0

func Fetcher() string

func Filepath added in v0.7.0

func Filepath() string

Filepath is the configuration file path.

func Init added in v0.7.0

func Init(c *cli.Context) error

Init initializes application-level configuration.

func InitFile added in v0.7.0

func InitFile(modules []module.Module) error

InitFile writes the current configuration to the current configuration file path.

func Interactive added in v0.7.0

func Interactive() bool

Interactive is true if the user desires interactive output.

func Modules added in v0.7.0

func Modules() ([]module.Module, error)

func Project added in v0.7.0

func Project() string

func Revision added in v0.7.0

func Revision() string

func Title added in v0.7.0

func Title() string

func TryFiles added in v0.7.0

func TryFiles(candidates ...string) (string, error)

func TryStrings added in v0.7.0

func TryStrings(candidates ...string) string

func UpdateFile added in v0.7.0

func UpdateFile(modules []module.Module) error

Types

type File added in v0.7.0

type File interface {
	APIKey() string
	Server() string

	Title() string
	Fetcher() string
	Project() string
	Branch() string
	Revision() string

	Modules() []module.Module
}

File defines the minimum interface for usage as a configuration file. We use an interface here in anticipation of new versions of configuration files, which will likely be implemented as different structs.

type NoFile added in v0.7.0

type NoFile struct{}

func (NoFile) APIKey added in v0.7.0

func (_ NoFile) APIKey() string

func (NoFile) Branch added in v0.7.0

func (_ NoFile) Branch() string

func (NoFile) Fetcher added in v0.7.0

func (_ NoFile) Fetcher() string

func (NoFile) Modules added in v0.7.0

func (_ NoFile) Modules() []module.Module

func (NoFile) Project added in v0.7.0

func (_ NoFile) Project() string

func (NoFile) Revision added in v0.7.0

func (_ NoFile) Revision() string

func (NoFile) Server added in v0.7.0

func (_ NoFile) Server() string

func (NoFile) Title added in v0.7.0

func (_ NoFile) Title() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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