Documentation ¶
Overview ¶
Package lib defines common code between op server and clients
Index ¶
Constants ¶
const ( CmdCancel CmdSwitch = "-c" // cancel client command; not for end users CmdExit = "-e" // shut down dedicated server CmdGlobal = "-g" // global switch; only valid as a command line arg CmdKill = "-k" // kill routes CmdList = "-l" // list active routes CmdMeta = "-m" // generate config from template and meta CmdPrint = "-p" // print config routes CmdRestart = "-r" // restart routes CmdRun = "" // run routes CmdServer = "-s" // run as dedicated server )
Variables ¶
var ( BasePath string // general pipe directory LockPath string // server lock file ConfigPath string // config file path TemplatePath string // template file path MetaPath string // meta file path Port string // server port )
var ( ArgSwitch CmdSwitch // execution switch ArgMajor string // route to execute, or meta variant to apply ArgMinor string // proc to execute )
Functions ¶
func ExecuteTemplate ¶
ExecuteTemplate reads the template from "op_template.yaml" in the current directory and applies the specified variant to it from working meta. If the OP_TEMPLATE env is set, reads the template from there instead. See DecodeMeta for meta specifications.
func PipePaths ¶
PipePaths returns the full paths for the pipe set to be used by the client with given id.
func UpdateMeta ¶
UpdateMeta updates the meta file to the specified meta.
Types ¶
type Cmd ¶
type Cmd struct { Sw CmdSwitch // command switch Namespace string // target namespace Route string // target route Proc string // target proc Config map[string]Route // manifest to use for command; may be nil for commands that don't need it }
Cmd represents an op program command
type Fmt ¶
type Fmt struct {
// contains filtered or unexported fields
}
A Fmt wraps an io.Writer to be concurrent safe. Also provides fmt package formating.
type Manifest ¶
type Manifest struct { Namespace string Var map[string]string Env map[string]string Routes map[string]Route }
A Manifest holds routes and their individual process configs.
func DecodeConfig ¶
DecodeConfig returns the manifest found at config path ("op.yaml" by default).
func MakeManifest ¶
func MakeManifest() Manifest
type Meta ¶
func DecodeMeta ¶
DecodeMeta returns a meta object from "op_meta.yaml" in the current directory. If the OP_META env is set, decodes from there instead.
type Proc ¶
type Proc struct { Var map[string]string Env map[string]string Name string Path string Dir string Args []string In string Out string Err string }
A Proc holds the information necessary to execute a process.
type Route ¶
type Route struct { Default bool // will run on no-argument forms Namespace string // route-scope namespace Var map[string]string // route-scope var Env map[string]string // route-scope env Procs []Proc // process configurations }
A Route holds information relevant to a single execution route.