Documentation ¶
Index ¶
- Constants
- Variables
- func CopyDir(srcPath string, dstPath string) error
- func CopyFile(srcPath, destPath string) error
- func CopyFileReplace(srcPath, destPath string, rStrings map[string]string) error
- func Debug(msg string)deprecated
- func Error(msg string)deprecated
- func HandleEdgeXConfig(service, envJSON string, extraConf map[string]string) error
- func Info(msg string)deprecated
- func Init(setDebug bool, snapName string) errordeprecated
- func Warn(msg string)deprecated
- type CtlCli
- func (cc *CtlCli) Config(key string) (string, error)
- func (cc *CtlCli) EnabledServices() ([]string, error)
- func (cc *CtlCli) SetConfig(key string, val string) error
- func (cc *CtlCli) Start(svc string, enable bool) error
- func (cc *CtlCli) StartMultiple(enable bool, services ...string) error
- func (cc *CtlCli) Stop(svc string, disable bool) error
- func (cc *CtlCli) UnsetConfig(key string) error
- type SnapCtl
Constants ¶
const ( // AutostartConfig is a configuration key used indicate that a // service (application or device) should be autostarted on install AutostartConfig = "autostart" // EnvConfig is the prefix used for configure hook keys used for // EdgeX configuration overrides. EnvConfig = "env" // ProfileConfig is a configuration key that specifies a named // configuration profile ProfileConfig = "profile" // ServiceConsul is the service key for Consul. ServiceConsul = "consul" // ServiceRedis is the service key for Redis. ServiceRedis = "redis" // ServiceData is the service key for EdgeX Core Data. ServiceData = "core-data" // ServiceMetadata is the service key for EdgeX Core MetaData. ServiceMetadata = "core-metadata" // ServiceCommand is the service key for EdgeX Core Command. ServiceCommand = "core-command" // ServiceNotify is the service key for EdgeX Support Notifications. ServiceNotify = "support-notifications" // ServiceSched is the service key for EdgeX Support Scheduler. ServiceSched = "support-scheduler" // ServiceAppCfg is the service key for EdgeX App Service Configurable. ServiceAppCfg = "app-service-configurable" // ServiceDevVirt is the service key for EdgeX Device Virtual. ServiceDevVirt = "device-virtual" // ServiceSecStore is the service key for EdgeX Security Secret Store (aka Vault). ServiceSecStore = "security-secret-store" // ServiceProxy is the service key for EdgeX API Gateway (aka Kong). ServiceProxy = "security-proxy" // ServiceSysMgmt is the service key for EdgeX SMA (sys-mgmt-agent). ServiceSysMgmt = "sys-mgmt-agent" // ServiceKuiper is the service key for the Kuiper rules engine. ServiceKuiper = "kuiper" // ServiceSecBootstrapper is the service key for the security-bootstrapper, // a one-shot service that bootstraps per-service Consul ACLS required to // access Consul for configuration or registry services. ServiceSecBootstrapper = "security-bootstrapper" )
Variables ¶
var ( // Snap contains the value of the SNAP environment variable. Snap string // SnapConf contains the expanded path '$SNAP/config'. SnapConf string // SnapCommon contains the value of the SNAP_COMMON environment variable. SnapCommon string // SnapData contains the value of the SNAP_DATA environment variable. SnapData string // SnapDataConf contains the expanded path '$SNAP_DATA/config'. SnapDataConf string // SnapInst contains the value of the SNAP_INSTANCE_NAME environment variable. SnapInst string // SnapName contains the value of the SNAP_NAME environment variable. SnapName string // SnapRev contains the value of the SNAP_REVISION environment variable. SnapRev string )
Deprecated: use the env package
var ConfToEnv = map[string]string{
"service.health-check-interval": "SERVICE_HEALTHCHECKINTERVAL",
"service.host": "SERVICE_HOST",
"service.port": "SERVICE_PORT",
"service.server-bind-addr": "SERVICE_SERVERBINDADDR",
"service.startup-msg": "SERVICE_STARTUPMSG",
"service.max-result-count": "SERVICE_MAXRESULTCOUNT",
"service.max-request-size": "SERVICE_MAXREQUESTSIZE",
"service.request-timeout": "SERVICE_REQUESTTIMEOUT",
"secret-store.secrets-file": "SECRETSTORE_SECRETSFILE",
"secret-store.disable-scrub-secrets-file": "SECRETSTORE_DISABLESCRUBSECRETSFILE",
"clients.core-command.port": "CLIENTS_CORECOMMAND_PORT",
"clients.core-data.port": "CLIENTS_COREDATA_PORT",
"clients.core-metadata.port": "CLIENTS_COREMETADATA_PORT",
"clients.support-notifications.port": "CLIENTS_SUPPORTNOTIFICATIONS_PORT",
"clients.support-scheduler.port": "CLIENTS_SUPPORTSCHEDULER_PORT",
"messagequeue.type": "core-data,device-virtual/MESSAGEQUEUE_TYPE",
"messagequeue.protocol": "core-data,device-virtual/MESSAGEQUEUE_PROTOCOL",
"messagequeue.host": "core-data,device-virtual/MESSAGEQUEUE_HOST",
"messagequeue.port": "core-data,device-virtual/MESSAGEQUEUE_PORT",
"messagequeue.publish-topic-prefix": "core-data,device-virtual/MESSAGEQUEUE_PUBLISHTOPICPREFIX",
"messagequeue.subscribe-topic": "core-data,device-virtual/MESSAGEQUEUE_SUBSCRIBETOPIC",
"messagequeue.auth-mode": "core-data,device-virtual/MESSAGEQUEUE_AUTHMODE",
"messagequeue.secret-name": "core-data,device-virtual/MESSAGEQUEUE_SECRETNAME",
"messagequeue.subscribe-enabled": "core-data,device-virtual/MESSAGEQUEUE_SUBSCRIBEENABLED",
"trigger.edgex-message-bus.subscribe-host.port": "app-service-config/TRIGGER_EDGEXMESSAGEBUS_SUBSCRIBEHOST_PORT",
"trigger.edgex-message-bus.subscribe-host.protocol": "app-service-config/TRIGGER_EDGEXMESSAGEBUS_SUBSCRIBEHOST_PROTOCOL",
"trigger.edgex-message-bus.subscribe-host.subscribe-topics": "app-service-config/TRIGGER_EDGEXMESSAGEBUS_SUBSCRIBEHOST_SUBSCRIBETOPICS",
"trigger.edgex-message-bus.publish-host.port": "app-service-config/TRIGGER_EDGEXMESSAGEBUS_PUBLISHHOST_PORT",
"trigger.edgex-message-bus.publish-host.protocol": "app-service-config/TRIGGER_EDGEXMESSAGEBUS_PUBLISHHOST_PROTOCOL",
"trigger.edgex-message-bus.publish-host.publish-topic": "app-service-config/TRIGGER_EDGEXMESSAGEBUS_PUBLISHHOST_PUBLISHTOPIC",
"smtp.host": "support-notifications/SMTP_HOST",
"smtp.username": "support-notifications/SMTP_USERNAME",
"smtp.password": "support-notifications/SMTP_PASSWORD",
"smtp.port": "support-notifications/SMTP_PORT",
"smtp.sender": "support-notifications/SMTP_SENDER",
"smtp.enable-self-signed-cert": "support-notifications/SMTP_ENABLE_SELF_SIGNED_CERT",
"smtp.subject": "support-notifications/SMTP_SUBJECT",
"smtp.auth-mode": "support-notifications/SMTP_AUTHMODE",
"add-proxy-route": "security-proxy/ADD_PROXY_ROUTE",
"kongauth.name": "security-proxy/KONGAUTH_NAME",
"add-secretstore-tokens": "security-secret-store/ADD_SECRETSTORE_TOKENS",
"add-known-secrets": "security-secret-store/ADD_KNOWN_SECRETS",
"default-token-ttl": "security-secret-store/TOKENFILEPROVIDER_DEFAULTTOKENTTL",
"add-registry-acl-roles": "security-bootstrapper/ADD_REGISTRY_ACL_ROLES",
}
ConfToEnv defines mappings from snap config keys to EdgeX environment variable names that are used to override individual service configuration values via a .env file read by the snap service wrapper.
The syntax to set a configuration key is:
env.<service name>.<section>.<keyname>
var Services = []string{ ServiceConsul, ServiceRedis, ServiceData, ServiceMetadata, ServiceCommand, ServiceNotify, ServiceSched, ServiceAppCfg, ServiceDevVirt, ServiceSecStore, ServiceProxy, ServiceSysMgmt, ServiceKuiper, ServiceSecBootstrapper, }
Services is a string array of all of the edgexfoundry snap services.
Functions ¶
func CopyDir ¶ added in v2.3.0
CopyDir copies a whole directory recursively snippet from https://blog.depa.do/post/copy-files-and-directories-in-go
func CopyFileReplace ¶
CopyFileReplace copies a file within the snap and replaces strings using the string/replace values in the rStrings parameter.
func HandleEdgeXConfig ¶
Deprecated HandleEdgeXConfig processes snap configuration which can be used to override edgexfoundry configuration via environment variables sourced by the snap service wrapper script. The parameter service is used to create a new service specific file (named <service>.env) in the $SNAP_DATA/config/res directory of the service. The parameter envJSON is a JSON document holding the service's configuration as returned by snapd. The parameter extraConfig is a map of additional configuration keys supported by the snap. For example the following configuration option:
[Driver] MyDriverOption = "foo"
...would require an entry in extraConf like this:
extraConf["driver.mydriveroption"]"DRIVER_MYDRIVEROPTION"
.. and would be set like this for a device or application service:
``` $ sudo snap set mysnap env.driver.mydriveroption="foo" ```
Types ¶
type CtlCli ¶
type CtlCli struct{}
Deprecated CtlCli is the test obj for overridding functions
func (*CtlCli) EnabledServices ¶ added in v2.1.0
Deprecated EnabledServices uses snapctl to get the list of enabled services
func (*CtlCli) SetConfig ¶
Deprecated SetConfig uses snapctl to set a config value from a key, or returns error.
func (*CtlCli) StartMultiple ¶ added in v2.1.0
Deprecated StartMultiple uses snapctl to start one or more services and optionally enable all
func (*CtlCli) UnsetConfig ¶ added in v2.1.0
Deprecated UnsetConfig uses snapctl to unset a config value from a key
Directories ¶
Path | Synopsis |
---|---|
* Copyright (C) 2021 Canonical Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License.
|
* Copyright (C) 2021 Canonical Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. |