cfg

package
v0.0.150 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultWorkspaceEnvironments = []*schema.Workspace_EnvironmentSpec{
		{
			Name:    "dev",
			Runtime: "kubernetes",
			Purpose: schema.Environment_DEVELOPMENT,
		},
		{
			Name:    "staging",
			Runtime: "kubernetes",
			Purpose: schema.Environment_PRODUCTION,
		},
		{
			Name:    "prod",
			Runtime: "kubernetes",
			Purpose: schema.Environment_PRODUCTION,
		},
	}
)

Functions

func EnvsOrDefault

func EnvsOrDefault(devHost *schema.DevHost, workspace *schema.Workspace) []*schema.Workspace_EnvironmentSpec

func GetMultiple

func GetMultiple[V proto.Message](config Configuration) ([]V, error)

func IsValidConfigType

func IsValidConfigType(msg *anypb.Any) bool

func LookupConfigMessage

func LookupConfigMessage(name protoreflect.FullName) protoreflect.MessageType

func RegisterConfigurationProvider

func RegisterConfigurationProvider[V proto.Message](handle func(V) ([]proto.Message, error), aliases ...string)

func ValidateNoConfigTypeCollisions

func ValidateNoConfigTypeCollisions()

Types

type ConfigType

type ConfigType[V proto.Message] struct {
	// contains filtered or unexported fields
}

func DefineConfigType

func DefineConfigType[V proto.Message](aliases ...string) ConfigType[V]

func (ConfigType[V]) CheckGet

func (ct ConfigType[V]) CheckGet(cfg Configuration) (V, bool)

func (ConfigType[V]) CheckGetForPlatform

func (ct ConfigType[V]) CheckGetForPlatform(cfg Configuration, target specs.Platform) (V, bool)

type Configuration

type Configuration interface {
	Derive(string, func(ConfigurationSlice) ConfigurationSlice) Configuration

	// When the configuration is loaded pinned to an environment, returns the
	// environment name. Else, the return value is undefined. This value MUST
	// NOT be used as an authoritative cache key.
	EnvKey() string

	Workspace() Workspace
	// contains filtered or unexported methods
}

func MakeConfigurationCompat

func MakeConfigurationCompat(errorloc fnerrors.Location, ws Workspace, devHost *schema.DevHost, env *schema.Environment) (Configuration, error)

func MakeConfigurationWith

func MakeConfigurationWith(description string, ws Workspace, merged ConfigurationSlice) Configuration

type ConfigurationSlice

type ConfigurationSlice struct {
	Configuration         []*anypb.Any
	PlatformConfiguration []*schema.DevHost_ConfigurePlatform
}

type Context

type Context interface {
	fnerrors.Location
	Workspace() Workspace
	Configuration() Configuration
	Environment() *schema.Environment
}

func LoadContext

func LoadContext(parent RootContext, name string) (Context, error)

func MakeUnverifiedContext

func MakeUnverifiedContext(config Configuration, env *schema.Environment) Context

type RootContext

type RootContext interface {
	fnerrors.Location
	DevHost() *schema.DevHost
	Workspace() Workspace
}

type Workspace

type Workspace interface {
	fnerrors.Location

	Proto() *schema.Workspace
	ModuleName() string
	ReadOnlyFS(rel ...string) fs.FS
	LoadedFrom() *schema.Workspace_LoadedFrom
}

func MakeSyntheticWorkspace added in v0.0.84

func MakeSyntheticWorkspace(proto *schema.Workspace, lf *schema.Workspace_LoadedFrom) Workspace

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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