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 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 Fork ¶
func Fork(cfg ...interface{})
Fork is an wrapper around NewEnv that enables a program to run normally or like a daemon with start|stop signals and control referencse are written to /var/fork/{name.pid} and should be left alone for proper Fork processing
func NewEnv ¶ added in v1.6.0
func NewEnv(cfg ...interface{}) *paths
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
type params struct {
env:"alias,order,require,environ,hidden"
help:"description"
default:"value"
Action string `env:"require" default:"server" help:"action [server|client]"`
}
supports bool, string, int types
func NewEnvSilent ¶ added in v1.7.0
func NewEnvSilent(cfg ...interface{}) *paths
NewEnvSilent sets up a silent environment
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 Parser ¶
func (*Parser) Do ¶ added in v1.6.0
func (p *Parser) Do(cfg ...interface{})
Do will set the speficied cfg struct field value according to the tag:env and tag:default provided in the struct, and will overload in the following order:
tag:default, conf k:v sets, os.Args, os.Environ
final values in the key:value os.Environment table.
env: alias,require,order,environ field flags supports: string, bool, int/64, uint/64 types