config

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 19 Imported by: 4

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

This section is empty.

Types

type Environment added in v0.0.25

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

Environment is receiver that holds Environment variables and encapsulates toml.Tree-based configuration field overrides. Assumes "_" embedded in Environment variable key separates substructs; e.g. foo_bar_baz might refer to

		type foo struct {
			bar struct {
         	baz string
 		}
		}

func NewEnvironment added in v0.0.25

func NewEnvironment() *Environment

NewEnvironment constructor reads/stores os.Environ() for use by Environment receiver methods.

func (*Environment) GetRegistryProviderInfoOverride added in v0.0.25

func (_ *Environment) GetRegistryProviderInfoOverride(lc logger.LoggingClient) string

TODO: Remove this func for release V2.0.0 This is for backwards compatibility with Fuji Device Services. If --registry=<url> is used then we must use the <url> for the configuration provider. GetRegistryProviderInfoOverride get the overrides for Registry Provider Config values from an Environment variable value (if it exists).

func (*Environment) OverrideConfigProviderInfo added in v0.0.25

func (_ *Environment) OverrideConfigProviderInfo(
	lc logger.LoggingClient,
	configProviderInfo types.ServiceConfig) (types.ServiceConfig, error)

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

func (*Environment) OverrideConfiguration added in v0.0.25

func (e *Environment) OverrideConfiguration(lc logger.LoggingClient, serviceConfig interface{}) (int, error)

OverrideConfiguration method replaces values in the configuration for matching Environment variable keys. serviceConfig must be pointer to the service configuration.

func (*Environment) OverrideStartupInfo added in v0.0.25

func (_ *Environment) OverrideStartupInfo(
	lc logger.LoggingClient,
	startup config.StartupInfo) config.StartupInfo

OverrideStartupInfo overrides the Service StartupInfo values from an Environment variable value (if it exists).

func (*Environment) UseRegistry added in v0.0.25

func (e *Environment) UseRegistry() bool

UseRegistry returns whether the envKeyRegistryUrl key is set TODO: remove this func for release v2.0.0 when envKeyRegistryUrl is removed

type Processor added in v0.0.25

type Processor struct {
	Logger logger.LoggingClient
	// contains filtered or unexported fields
}

func NewProcessor added in v0.0.25

func NewProcessor(
	lc logger.LoggingClient,
	flags flags.Common,
	environment *Environment,
	startupTimer startup.Timer,
	ctx context.Context,
	wg *sync.WaitGroup,
	configUpdated UpdatedStream,
) *Processor

NewProcessor creates a new configuration Processor

func (*Processor) Process added in v0.0.25

func (cp *Processor) Process(serviceKey string, configStem string, serviceConfig interfaces.Configuration) error

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, environment *Environment, 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 added in v0.0.18

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