config

package
v4.0.0-dev.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Overview

******************************************************************************

  • Copyright 2020 Intel Corp.
  • Copyright 2024 IOTech Ltd *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. ******************************************************************************

Index

Constants

View Source
const (
	SecurityModeKey = "Mode"
)

Variables

This section is empty.

Functions

func CreateProviderClient

func CreateProviderClient(
	lc logger.LoggingClient,
	serviceKey string,
	configStem string,
	providerConfig types.ServiceConfig) (configuration.Client, error)

CreateProviderClient creates and returns a configuration.Client instance and logs Client connection information

func GetConfigFileLocation

func GetConfigFileLocation(lc logger.LoggingClient, flags flags.Common) string

GetConfigFileLocation uses the environment variables and flags to determine the location of the configuration

func GetInsecureSecretDataFullPath

func GetInsecureSecretDataFullPath(secretName, key string) string

GetInsecureSecretDataFullPath returns the full configuration path of an InsecureSecret's SecretData for a specific key. example: Writable/InsecureSecrets/credentials001/SecretData/username

func GetInsecureSecretNameFullPath

func GetInsecureSecretNameFullPath(secretName string) string

GetInsecureSecretNameFullPath returns the full configuration path of an InsecureSecret's SecretName field. example: Writable/InsecureSecrets/credentials001/SecretName

Types

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(
	flags flags.Common,
	envVars *environment.Variables,
	startupTimer startup.Timer,
	ctx context.Context,
	wg *sync.WaitGroup,
	configUpdated UpdatedStream,
	dic *di.Container,
) *Processor

NewProcessor creates a new configuration Processor

func NewProcessorForCustomConfig

func NewProcessorForCustomConfig(
	flags flags.Common,
	ctx context.Context,
	wg *sync.WaitGroup,
	dic *di.Container) *Processor

func (*Processor) ListenForCustomConfigChanges

func (cp *Processor) ListenForCustomConfigChanges(
	configToWatch any,
	sectionName string,
	changedCallback func(any))

ListenForCustomConfigChanges listens for changes to the specified custom configuration section. When changes occur it applies the changes to the custom configuration section and signals the changes have occurred.

func (*Processor) LoadCustomConfigSection

func (cp *Processor) LoadCustomConfigSection(updatableConfig interfaces.UpdatableConfig, sectionName string) error

LoadCustomConfigSection loads the specified custom configuration section from file or Configuration provider. Section will be seed if Configuration provider does yet have it. This is used for structures custom configuration in App and Device services

func (*Processor) Process

func (cp *Processor) Process(
	serviceKey string,
	serviceType string,
	configStem string,
	serviceConfig interfaces.Configuration,
	secretProvider interfaces.SecretProviderExt,
	jwtSecretProvider clientinterfaces.AuthenticationInjector) error

type ProviderInfo

type ProviderInfo struct {
	// contains filtered or unexported fields
}

ProviderInfo encapsulates the usage of the Configuration Provider information

func NewProviderInfo

func NewProviderInfo(envVars *environment.Variables, providerUrl string) (*ProviderInfo, error)

NewProviderInfo creates a new ProviderInfo and initializes it

func (*ProviderInfo) ServiceConfig

func (config *ProviderInfo) ServiceConfig() types.ServiceConfig

ServiceConfig returns service configuration for the Configuration Provider

func (*ProviderInfo) SetAuthInjector

func (config *ProviderInfo) SetAuthInjector(authInjector interfaces.AuthenticationInjector)

SetAuthInjector sets the Authentication Injector for the Configuration Provider

func (*ProviderInfo) SetHost

func (config *ProviderInfo) SetHost(host string)

SetHost sets the host name for the Configuration Provider.

func (*ProviderInfo) UseProvider

func (config *ProviderInfo) UseProvider() bool

UseProvider returns whether the Configuration Provider should be used or not.

type UpdatedStream

type UpdatedStream chan struct{}

UpdatedStream defines the stream type that is notified by ListenForChanges when a configuration update is received.

Jump to

Keyboard shortcuts

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