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" EnvKeyCertPath = "BAETYL_CERT_PATH" EnvKeyAppVersion = "BAETYL_APP_VERSION" SystemCertCA = "ca.pem" SystemCertCrt = "crt.pem" SystemCertKey = "key.pem" SystemCertOU = "BAETYL" SystemAppInit = "baetyl-init" )
Env keys
Variables ¶
View Source
var (
ErrSystemCertInvalid = errors.New("failed to verify system certificate")
)
Functions ¶
Types ¶
type Context ¶
type Context interface { // NodeName returns node name. NodeName() string // AppName returns app name. AppName() string // AppVersion returns application version. AppVersion() 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{}) // Get get system resource object GetSystemResource() *SystemResource // 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 ¶
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
type SystemResource ¶ added in v2.0.14
type SystemResource struct {
// contains filtered or unexported fields
}
func (*SystemResource) GetSystemCert ¶ added in v2.0.14
func (s *SystemResource) GetSystemCert() (ca, crt, key []byte)
GetSystemCert get the signed certificate injected by the system, which can be used for TLS connection, etc.
Click to show internal directories.
Click to hide internal directories.