Documentation ¶
Index ¶
- Constants
- Variables
- func BrokerHost() string
- func BrokerPort() string
- func EdgeNamespace() string
- func EdgeSystemNamespace() string
- func FunctionHost() string
- func FunctionHttpPort() string
- func HostPathLib() (string, error)
- func PlatformString() string
- func Run(handle func(Context) error)
- func RunMode() string
- type Context
- type PlatformInfo
- type SystemConfig
Constants ¶
View Source
const ( SystemCertCA = "ca.pem" SystemCertCrt = "crt.pem" SystemCertKey = "key.pem" SystemCertPath = "var/lib/baetyl/system/certs" )
View Source
const ( KeyBaetyl = "BAETYL" KeyConfFile = "BAETYL_CONF_FILE" KeyNodeName = "BAETYL_NODE_NAME" KeyAppName = "BAETYL_APP_NAME" KeyAppVersion = "BAETYL_APP_VERSION" KeySvcName = "BAETYL_SERVICE_NAME" KeySysConf = "BAETYL_SYSTEM_CONF" KeyRunMode = "BAETYL_RUN_MODE" KeyServiceDynamicPort = "BAETYL_SERVICE_DYNAMIC_PORT" KeyBaetylHostPathLib = "BAETYL_HOST_PATH_LIB" )
All keys
View Source
const ( RunModeKube = "kube" RunModeNative = "native" )
Variables ¶
View Source
var ( ErrSystemCertInvalid = errors.New("system certificate is invalid") ErrSystemCertNotFound = errors.New("system certificate is not found") )
Functions ¶
func EdgeNamespace ¶ added in v2.0.55
func EdgeNamespace() string
EdgeNamespace return namespace of edge.
func EdgeSystemNamespace ¶ added in v2.0.55
func EdgeSystemNamespace() string
EdgeSystemNamespace return system namespace of edge.
func FunctionHttpPort ¶ added in v2.0.55
func FunctionHttpPort() string
FunctionPort return http port of function.
func HostPathLib ¶ added in v2.0.54
HostPathLib return HostPathLib
func PlatformString ¶ added in v2.0.36
func PlatformString() string
Types ¶
type Context ¶
type Context interface { // NodeName returns node name from data. NodeName() string // AppName returns app name from data. AppName() string // AppVersion returns application version from data. AppVersion() string // ServiceName returns service name from data. ServiceName() string // ConfFile returns config file from data. ConfFile() string // SystemConfig returns the config of baetyl system from data. SystemConfig() *SystemConfig // 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 // 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{}) // CheckSystemCert checks system certificate, if certificate is not found or invalid, returns an error. CheckSystemCert() error // LoadCustomConfig loads custom config. // If 'files' is empty, will load config from default path, // else the first file path will be used to load config from. LoadCustomConfig(cfg interface{}, files ...string) error // NewFunctionHttpClient creates a new function http client. NewFunctionHttpClient() (*http.Client, error) // NewSystemBrokerClientConfig creates the system config of broker NewSystemBrokerClientConfig() (mqtt.ClientConfig, error) // NewBrokerClient creates a new broker client. NewBrokerClient(mqtt.ClientConfig) (*mqtt.Client, error) // NewSystemBrokerClient creates a new system broker client. NewSystemBrokerClient([]mqtt.QOSTopic) (*mqtt.Client, error) }
Context of service
type PlatformInfo ¶ added in v2.0.36
func Platform ¶ added in v2.0.36
func Platform() PlatformInfo
type SystemConfig ¶ added in v2.0.21
type SystemConfig struct { Certificate utils.Certificate `` /* 198-byte string literal not displayed */ Function http.ClientConfig `yaml:"function,omitempty" json:"function,omitempty"` Broker mqtt.ClientConfig `yaml:"broker,omitempty" json:"broker,omitempty"` Logger log.Config `yaml:"logger,omitempty" json:"logger,omitempty"` }
SystemConfig config of baetyl system
Click to show internal directories.
Click to hide internal directories.