config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTargets

func GetTargets(ctx context.Context, accountIdentifier, orgIdentifier, projectIdentifier, environmentIdentifier string, adminService adminService) ([]domain.Target, error)

GetTargets retrieves all targets for a given environment

Types

type EnvironmentDetails

type EnvironmentDetails struct {
	EnvironmentIdentifier string
	EnvironmentID         string
	ProjectIdentifier     string
	HashedAPIKeys         []string
	APIKey                string
	Token                 string
	Targets               []domain.Target
}

EnvironmentDetails contains details about a configured environment

type LocalConfig

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

LocalConfig is a type that can traverse a tree of files and decode FeatureFlag, Target and Segment information from them.

func NewLocalConfig

func NewLocalConfig(fs fs.FS) (LocalConfig, error)

NewLocalConfig creates a new FeatureFlagConfig that loads config from the passed FileSystem and directory.

func (LocalConfig) AuthConfig

func (f LocalConfig) AuthConfig() map[domain.AuthAPIKey]string

AuthConfig returns the authentication config information

func (LocalConfig) FeatureFlag

func (f LocalConfig) FeatureFlag() map[domain.FeatureFlagKey]interface{}

FeatureFlag returns the FeatureFlag information from the FeatureFlag in the form of a map of domain.FeatureConfigKeys to slice of domain.FeatureFlag.

func (LocalConfig) Segments

func (f LocalConfig) Segments() map[domain.SegmentKey]interface{}

Segments returns the segment informatino from the FeatureFlagConfig in the form of a map of domain.SegmentKey to slice of domain.Segments

func (LocalConfig) Targets

func (f LocalConfig) Targets() map[domain.TargetKey]interface{}

Targets returns the target information from the FeatureFlagConfig in the form of a map of domain.TargetKey to slice of domain.Target

type RemoteConfig

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

RemoteConfig is a type that retrieves config from the Feature Flags Service

func NewRemoteConfig

func NewRemoteConfig(ctx context.Context, accountIdentifier string, orgIdentifier string, apiKeys []string, adminService adminService, clientService clientService, opts ...RemoteOption) (RemoteConfig, error)

NewRemoteConfig creates a RemoteConfig and retrieves the configuration for the given Account, Org and APIKeys from the Feature Flags Service

func (RemoteConfig) AuthConfig

func (r RemoteConfig) AuthConfig() map[domain.AuthAPIKey]string

AuthConfig returns the AuthConfig that was retrieved from the Feature Flags Service

func (RemoteConfig) EnvInfo

func (r RemoteConfig) EnvInfo() map[string]EnvironmentDetails

EnvInfo returns the EnvironmentDetails that was retrieved from the Feature Flags Service

func (RemoteConfig) TargetConfig

func (r RemoteConfig) TargetConfig() map[domain.TargetKey]interface{}

TargetConfig returns the Target information that was retrieved from the Feature Flags Service

func (RemoteConfig) Tokens

func (r RemoteConfig) Tokens() map[string]string

Tokens returns the map of environment ids to auth tokens that was retrieved from the Feature Flags Service

type RemoteOption

type RemoteOption func(r *RemoteConfig)

RemoteOption is type for passing optional parameters to a RemoteConfig

func WithFetchTargets

func WithFetchTargets(fetchTargets bool) RemoteOption

WithFetchTargets specifies if the RemoteConfig instance should fetch targets or not

func WithLogger

func WithLogger(l log.Logger) RemoteOption

WithLogger can be used to pass a logger to the RemoteConfig, its default logger is one that logs to stderr and has debug logging disabled

Jump to

Keyboard shortcuts

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