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 ¶
- Variables
- func APIKey() string
- func BoolFlag(name string) bool
- func Branch() string
- func Debug() bool
- func Endpoint() string
- func Fetcher() string
- func Filepath() string
- func Init(c *cli.Context) error
- func Interactive() bool
- func Modules() ([]module.Module, error)
- func Project() string
- func Revision() string
- func StringFlag(name string) string
- func Title() string
- func TryFiles(candidates ...string) (string, error)
- func TryStrings(candidates ...string) string
- func UpdateFile(modules []module.Module) error
- func WriteFile(modules []module.Module) error
- type File
- type NoFile
Constants ¶
This section is empty.
Variables ¶
var ErrFileNotFound = errors.New("no files existed")
var (
MockBranch string
)
*** Mock configuration values ***
Functions ¶
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 Interactive ¶ added in v0.7.0
func Interactive() bool
Interactive is true if the user desires interactive output.
func StringFlag ¶ added in v0.7.0
func TryStrings ¶ added in v0.7.0
func UpdateFile ¶ added in v0.7.0
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.