Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Version, Build string
Description string
)
These var should be set externally by the build command
Functions ¶
func Configure ¶ added in v1.7.2
func Configure(cfg ...interface{}) (path struct {
Etc, Srv, Var, Tmp string
})
Configure sets up the basic environment and returns environment paths; pass Options as the first item to set or specify custom configuration options to silence log and help output and env.Options.M map populates, struct initially, overloaded by environment vars, overloaded by default tag, that is then overloaded by command line swithches, in this order
func Dir ¶
Dir will create the directory tree when it does not exist and return a string representation of the full composite path. A file is presumed when the last element contains any of the following ._- characters and fs.FileMode is coded to 0755
func NewEnv ¶ added in v1.6.0
func NewEnv(cfg ...interface{}) (path struct {
Etc, Srv, Var, Tmp string
})
NewEnv that sets up the basic envrionment paths and calls the Parser to process the struct tag fields and populates any interfaces that are provided
tags env:"alias,order,require,environ,hidden" help:"description" default:"value" (bool, string, int) Action string `env:"A,require" default:"server" help:"action [server|client]"`
func NewGraceful ¶ added in v1.6.0
func NewGraceful() *graceful
NewGraceful configurator returns *graceful and starts the shutdown controller to capture (os.Interrupt, syscall.SIGTERM, syscall.SIGHUP) signals and waits on the <-graceful.context.Done() for a signal and waits for the graceful.Manager controller wgShutdown to confirm all managed processes and completed tasks before the program terminates execution
Types ¶
type Expire ¶ added in v1.1.0
type Expire struct {
CheckOn time.Duration // frequency of checks (default: hourly)
// contains filtered or unexported fields
}
Expire struct
func (*Expire) Add ¶ added in v1.1.0
Add will register a directory/path with customized age timeframe (default: 24hr expiration)
type Lock ¶ added in v1.7.0
type Lock string
Lock directory; default /tmp
func (*Lock) Exist ¶ added in v1.7.0
Exist reports the {file}.lock state as a boolean and expires the lock when past the ttl; default 1hr
type Options ¶ added in v1.7.2
type Options struct {
Silent bool // silence log configuration output
NoHelp bool // silence help output
SetENV bool // set KEY=VALUE in environment
}
Options for env.Configure
Silent: log configuration output NoHelp: silences the help output SetENV: set KEY=VALUE in environemnt