envfactory

package
v6.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package envfactory contains types related to service-driven environment configuration, shared by the autoconfig and filedata packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvConfigFactory

type EnvConfigFactory struct {
	// DataStorePrefix is the configured data store prefix, which may contain a per-environment placeholder.
	DataStorePrefix string
	// DataStorePrefix is the configured data store table name, which may contain a per-environment placeholder.
	TableName string
	//
	AllowedOrigin ct.OptStringList
	AllowedHeader ct.OptStringList
}

EnvConfigFactory is an abstraction of the logic for generating environment configurations that are partly parameterized, instead of each environment being manually configured. This is used in both auto-configuration mode and offline mode.

func NewEnvConfigFactoryForAutoConfig

func NewEnvConfigFactoryForAutoConfig(c config.AutoConfigConfig) EnvConfigFactory

NewEnvConfigFactoryForAutoConfig creates an EnvConfigFactory based on the auto-configuration mode settings.

func NewEnvConfigFactoryForOfflineMode

func NewEnvConfigFactoryForOfflineMode(c config.OfflineModeConfig) EnvConfigFactory

NewEnvConfigFactoryForOfflineMode creates an EnvConfigFactory based on the offline mode settings.

func (EnvConfigFactory) MakeEnvironmentConfig

func (f EnvConfigFactory) MakeEnvironmentConfig(params EnvironmentParams) config.EnvConfig

MakeEnvironmentConfig creates an EnvConfig based on both the individual EnvironmentParams and the properties of the EnvConfigFactory.

type EnvironmentParams

type EnvironmentParams struct {
	// ID is the environment ID.
	EnvID config.EnvironmentID

	// Identifiers contains the project and environment names and keys.
	Identifiers relayenv.EnvIdentifiers

	// SDKKey is the environment's SDK key; if there is more than one active key, it is the latest.
	SDKKey config.SDKKey

	// MobileKey is the environment's mobile key.
	MobileKey config.MobileKey

	// DeprecatedSDKKey is an additional SDK key that should also be allowed (but not surfaced as
	// the canonical one), or "" if none. The expiry time is not represented here; it is managed
	// by lower-level components.
	ExpiringSDKKey config.SDKKey

	// TTL is the cache TTL for PHP clients.
	TTL time.Duration

	// SecureMode is true if secure mode is required for this environment.
	SecureMode bool
}

EnvironmentParams contains environment-specific information obtained from LaunchDarkly which will be used to configure a Relay environment in auto-configuration mode or offline mode.

This is a simplified representation that does not contain all of the properties used in the auto-configuration or offline mode protocols, but only the ones that the core Relay logic needs.

type EnvironmentRep

type EnvironmentRep struct {
	EnvID      config.EnvironmentID `json:"envID"`
	EnvKey     string               `json:"envKey"`
	EnvName    string               `json:"envName"`
	MobKey     config.MobileKey     `json:"mobKey"`
	ProjKey    string               `json:"projKey"`
	ProjName   string               `json:"projName"`
	SDKKey     SDKKeyRep            `json:"sdkKey"`
	DefaultTTL int                  `json:"defaultTtl"`
	SecureMode bool                 `json:"secureMode"`
	Version    int                  `json:"version"`
}

EnvironmentRep is a representation of an environment that is being added or updated.

func (EnvironmentRep) ToParams

func (r EnvironmentRep) ToParams() EnvironmentParams

ToParams converts the JSON properties for an environment into our internal parameter type.

type ExpiringKeyRep

type ExpiringKeyRep struct {
	Value     config.SDKKey              `json:"value"`
	Timestamp ldtime.UnixMillisecondTime `json:"timestamp"`
}

ExpiringKeyRep describes an old key that will expire at the specified date/time.

type SDKKeyRep

type SDKKeyRep struct {
	Value    config.SDKKey `json:"value"`
	Expiring ExpiringKeyRep
}

SDKKeyRep describes an SDK key optionally accompanied by an old expiring key.

Jump to

Keyboard shortcuts

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