Documentation
¶
Index ¶
Constants ¶
View Source
const ( EnvKeyConfFile = "BAETYL_CONF_FILE" EnvKeyNodeName = "BAETYL_NODE_NAME" EnvKeyAppName = "BAETYL_APP_NAME" EnvKeyServiceName = "BAETYL_SERVICE_NAME" EnvKeyCodePath = "BAETYL_CODE_PATH" )
Env keys
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context interface { // NodeName returns node name. NodeName() string // AppName returns app name. AppName() string // ServiceName returns service name. ServiceName() string // ConfFile returns config file. ConfFile() string // ServiceConfig returns service config. ServiceConfig() ServiceConfig // Load returns the value stored in the map for a key, or nil if no value is present. // The ok result indicates whether value was found in the map. Load(key interface{}) (value interface{}, ok bool) // Store sets the value for a key. Store(key, value interface{}) // LoadOrStore returns the existing value for the key if present. // Otherwise, it stores and returns the given value. // The loaded result is true if the value was loaded, false if stored. LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) // Delete deletes the value for a key. Delete(key interface{}) // LoadCustomConfig loads custom config, if path is empty, will load config from default path. LoadCustomConfig(cfg interface{}, files ...string) error // Log returns logger interface. Log() *log.Logger // Wait waits until exit, receiving SIGTERM and SIGINT signals. Wait() // WaitChan returns wait channel. WaitChan() <-chan os.Signal }
Context of service
func NewContext ¶ added in v0.1.12
NewContext creates a new context
type ServiceConfig ¶
type ServiceConfig struct { HTTP http.ClientConfig `yaml:"http,omitempty" json:"http,omitempty"` MQTT mqtt.ClientConfig `yaml:"mqtt,omitempty" json:"mqtt,omitempty"` Logger log.Config `yaml:"logger,omitempty" json:"logger,omitempty"` }
ServiceConfig base config of service
Click to show internal directories.
Click to hide internal directories.