config

package
v0.0.0-...-4aed6a1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

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

  • Copyright 2020 Intel Corp. *
  • 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

This section is empty.

Variables

This section is empty.

Functions

func ListenForChanges

func ListenForChanges(
	ctx context.Context,
	wg *sync.WaitGroup,
	config interfaces.Configuration,
	lc logger.LoggingClient,
	configClient configuration.Client,
	stream UpdatedStream)

ListenForChanges leverages the registry client's WatchForChanges() method to receive changes to and update the service's configuration struct's writable sub-struct. It's assumed the log level is universally part of the writable struct and this function explicitly updates the loggingClient's log level when new configuration changes are received.

func LoadFromFile

func LoadFromFile(
	lc logger.LoggingClient,
	configDir,
	profileDir,
	configFileName string,
	config interfaces.Configuration) error

LoadFromFile attempts to read and unmarshal toml-based configuration into a configuration struct.

func OverrideConfigProviderInfoFromEnvironment

func OverrideConfigProviderInfoFromEnvironment(
	lc logger.LoggingClient,
	configProviderInfo types.ServiceConfig) (types.ServiceConfig, error)

OverrideConfigProviderInfoFromEnvironment overrides the Configuration Provider ServiceConfig values from an environment variable value (if it exists).

func OverrideStartupInfoFromEnvironment

func OverrideStartupInfoFromEnvironment(
	lc logger.LoggingClient,
	startup config.StartupInfo) config.StartupInfo

OverrideStartupInfoFromEnvironment overrides the Service StartupInfo values from an environment variable value (if it exists).

func UpdateFromProvider

func UpdateFromProvider(
	ctx context.Context,
	startupTimer startup.Timer,
	providerConfig configTypes.ServiceConfig,
	serviceConfig interfaces.Configuration,
	configStem string,
	lc logger.LoggingClient,
	serviceKey string) (configuration.Client, error)

UpdateFromProvider connects to the config provider, gets configuration, and updates the service's configuration struct.

Types

type ProviderInfo

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

ProviderInfo encapsulates the usage of the Configuration Provider information

func NewProviderInfo

func NewProviderInfo(lc logger.LoggingClient, 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) 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