config

package module
v0.0.0-...-ce13424 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: NCSA Imports: 22 Imported by: 211

README

config Build Status

Configuration entry point for both RAI and CarML

Documentation

Index

Constants

View Source
const (
	DefaultAppDescription = ""
)

DefaultAppDescription ...

Variables

View Source
var (
	DefaultAppName   = "rai"
	DefaultAppSecret string
	DefaultAppColor  = !color.NoColor
	IsDebug          bool
	IsVerbose        bool

	App = &appConfig{
		Name:        DefaultAppName,
		Description: DefaultAppDescription,
		Version: VersionInfo{
			Version:    "0.2.0",
			BuildDate:  time.Now().String(),
			GitCommit:  "-dirty-",
			GitBranch:  "-dirty-",
			GitState:   "-dirty-",
			GitSummary: "-dirty-",
		},
		done: make(chan struct{}),
	}
)

DefaultAppName ...

Functions

func AfterInit

func AfterInit(f func())

AfterInit ...

func BeforeInit

func BeforeInit(f func())

BeforeInit ...

func Debug

func Debug()

Debug ...

func Init

func Init(opts ...Option)

Init ...

func IsValidRemotePrefix

func IsValidRemotePrefix(s string) bool

func OnInit

func OnInit(f func())

OnInit ...

func Register

func Register(mod ConfigInterface)

Register ...

func SetAppSecret

func SetAppSecret(s string)

SetAppSecret ...

Types

type ConfigInterface

type ConfigInterface interface {
	ConfigName() string
	SetDefaults()
	Read()
	Wait()
	String() string
	Debug()
}

ConfigInterface ...

type Option

type Option func(*Options)

Option ...

func AppName

func AppName(s string) Option

AppName ...

func AppSecret

func AppSecret(s string) Option

AppSecret ...

func ColorMode

func ColorMode(b bool) Option

ColorMode ...

func ConfigEnvironName

func ConfigEnvironName(s string) Option

ConfigEnvironName ...

func ConfigFileAbsolutePath

func ConfigFileAbsolutePath(s string) Option

ConfigFileAbsolutePath ...

func ConfigFileBaseName

func ConfigFileBaseName(s string) Option

ConfigFileBaseName ...

func ConfigFileType

func ConfigFileType(s string) Option

ConfigFileType ...

func ConfigRemotePath

func ConfigRemotePath(s string) Option

ConfigRemotePath ...

func ConfigSearchPaths

func ConfigSearchPaths(s []string) Option

ConfigSearchPaths ...

func ConfigString

func ConfigString(s string) Option

ConfigString ...

func DebugMode

func DebugMode(b bool) Option

DebugMode ...

func VerboseMode

func VerboseMode(b bool) Option

VerboseMode ...

type Options

type Options struct {
	AppName                string
	AppSecret              string
	ConfigSearchPaths      []string
	ConfigEnvironName      string
	ConfigFileBaseName     string
	ConfigFileType         string
	ConfigFileAbsolutePath string
	ConfigString           *string
	ConfigRemotePath       string
	IsVerbose              bool
	IsDebug                bool
}

Options ...

func NewOptions

func NewOptions() *Options

NewOptions ...

type VersionInfo

type VersionInfo struct {
	// Version is populated at compile time by govvv from ./VERSION
	Version string
	// GitCommit is populated at compile time by govvv.
	BuildDate string
	// GitState is populated at compile time by govvv.
	GitCommit  string
	GitBranch  string
	GitState   string
	GitSummary string
}

VersionInfo ...

Jump to

Keyboard shortcuts

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