config

package
v0.0.0-...-68b20d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEnv = "pro"
)

Functions

This section is empty.

Types

type ApplicationSettings

type ApplicationSettings struct {
	DeviceIds       string
	ResDir          string
	DriverDir       string
	IsScreenControl bool
	OTADir          string
	CloseAuthToken  bool
	GatewayEdition  string // 网关版本标识
	WebBuildPath    string // 前端路径
	TedgeNumber     string
}

type ConfigurationStruct

type ConfigurationStruct struct {
	Writable            WritableInfo
	MessageQueue        MessageQueueInfo
	Clients             map[string]bootstrapConfig.ClientInfo
	Databases           map[string]map[string]bootstrapConfig.Database
	Registry            bootstrapConfig.RegistryInfo
	Service             bootstrapConfig.ServiceInfo
	RpcServer           bootstrapConfig.RPCServiceInfo
	SecretStore         bootstrapConfig.SecretStoreInfo
	WebServer           bootstrapConfig.ServiceInfo
	DockerManage        DockerManage
	ApplicationSettings ApplicationSettings
	Topics              struct {
		CommandTopic TopicInfo
	}
}

Struct used to parse the JSON configuration file

func (*ConfigurationStruct) EmptyWritablePtr

func (c *ConfigurationStruct) EmptyWritablePtr() interface{}

EmptyWritablePtr returns a pointer to a service-specific empty WritableInfo struct. It is used by the bootstrap to provide the appropriate structure to registry.C's WatchForChanges().

func (*ConfigurationStruct) GetBootstrap

GetBootstrap returns the configuration elements required by the bootstrap. Currently, a copy of the configuration data is returned. This is intended to be temporary -- since ConfigurationStruct drives the configuration.toml's structure -- until we can make backwards-breaking configuration.toml changes (which would consolidate these fields into an bootstrapConfig.BootstrapConfiguration struct contained within ConfigurationStruct).

func (*ConfigurationStruct) GetDataDatabaseInfo

func (c *ConfigurationStruct) GetDataDatabaseInfo() map[string]bootstrapConfig.Database

GetDataDatabaseInfo returns a database information map for events & readings.

func (*ConfigurationStruct) GetDatabaseInfo

func (c *ConfigurationStruct) GetDatabaseInfo() map[string]bootstrapConfig.Database

GetDatabaseInfo returns a database information map.

func (*ConfigurationStruct) GetInsecureSecrets

func (c *ConfigurationStruct) GetInsecureSecrets() bootstrapConfig.InsecureSecrets

GetInsecureSecrets returns the service's InsecureSecrets.

func (*ConfigurationStruct) GetLogLevel

func (c *ConfigurationStruct) GetLogLevel() string

GetLogLevel returns the current ConfigurationStruct's log level.

func (*ConfigurationStruct) GetLogPath

func (c *ConfigurationStruct) GetLogPath() string

func (*ConfigurationStruct) GetPersisPeriod

func (c *ConfigurationStruct) GetPersisPeriod() int32

func (*ConfigurationStruct) GetPersistData

func (c *ConfigurationStruct) GetPersistData() bool

func (*ConfigurationStruct) GetRedisInfo

func (c *ConfigurationStruct) GetRedisInfo() map[string]bootstrapConfig.Database

GetDataDatabaseInfo returns a database information map for events & readings.

func (*ConfigurationStruct) GetRegistryInfo

func (c *ConfigurationStruct) GetRegistryInfo() bootstrapConfig.RegistryInfo

GetRegistryInfo returns the RegistryInfo from the ConfigurationStruct.

func (*ConfigurationStruct) IsThingModel

func (c *ConfigurationStruct) IsThingModel() bool

判断是否为物模型

func (*ConfigurationStruct) UpdateFromRaw

func (c *ConfigurationStruct) UpdateFromRaw(rawConfig interface{}) bool

UpdateFromRaw converts configuration received from the registry to a service-specific configuration struct which is then used to overwrite the service's existing configuration struct.

func (*ConfigurationStruct) UpdateWritableFromRaw

func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool

UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct which is then used to overwrite the service's existing configuration's WritableInfo struct.

type DockerManage

type DockerManage struct {
	ContainerConfigPath string
	HostRootDir         string
	DockerApiVersion    string
	Privileged          bool
}

type MessageQueueInfo

type MessageQueueInfo struct {
	// Host is the hostname or IP address of the broker, if applicable.
	Host string
	// Port defines the port on which to access the message queue.
	Port int
	// Protocol indicates the protocol to use when accessing the message queue.
	Protocol string
	// Indicates the message queue platform being used.
	Type string
	// Indicates the topic the data is published/subscribed
	SubscribeTopics []string
	// Indicates the topic prefix the data is published to. Note that /<device-profile-name>/<device-name> will be
	// added to this Publish Topic prefix as the complete publish topic
	PublishTopicPrefix string
	// Provides additional configuration properties which do not fit within the existing field.
	// Typically the key is the name of the configuration property and the value is a string representation of the
	// desired value for the configuration property.
	Optional map[string]string
}

MessageQueueInfo provides parameters related to connecting to a message bus

func (MessageQueueInfo) Enable

func (m MessageQueueInfo) Enable() bool

func (MessageQueueInfo) URL

func (m MessageQueueInfo) URL() string

URL constructs a URL from the protocol, host and port and returns that as a string.

type TopicInfo

type TopicInfo struct {
	Topic string
}

type WritableInfo

type WritableInfo struct {
	PersistData     atomic.Bool  `toml:"-"`
	PersistPeriod   atomic.Int32 `toml:"-"`
	LogLevel        string
	LogPath         string
	InsecureSecrets bootstrapConfig.InsecureSecrets
	DebugProfile    bool
	IsNewModel      bool
	LimitMethods    []string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL