options

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// #nosec G101 -- This is just the env var name
	APIKeyEnvVar = "PREFAB_API_KEY"
	APIURLVar    = "PREFAB_API_URL"
)

Variables

View Source
var ContextTelemetryModes = struct {
	PeriodicExample ContextTelemetryMode
	Shapes          ContextTelemetryMode
	None            ContextTelemetryMode
}{
	PeriodicExample: "periodic_example",
	Shapes:          "shapes",
	None:            "",
}

Functions

func GetDefaultAPIURLs

func GetDefaultAPIURLs() []string

Types

type ConfigSource

type ConfigSource struct {
	Store   StoreType
	Raw     string
	Path    string
	Default bool
}

func GetDefaultConfigSources

func GetDefaultConfigSources() []ConfigSource

func ParseConfigSource

func ParseConfigSource(rawSource string) (ConfigSource, error)

type ContextTelemetryMode added in v0.0.7

type ContextTelemetryMode string

type EnvLookup added in v0.3.0

type EnvLookup interface {
	LookupEnv(key string) (string, bool)
}

EnvLookup is an interface for looking up environment variables This is defined in pkg/internal/interfaces.go but we reference it here to avoid circular imports

type OnInitializationFailure

type OnInitializationFailure int
const (
	ReturnError    OnInitializationFailure = iota // ReturnError = 0
	ReturnNilMatch                                // ReturnNilMatch = 1
)

type Options

type Options struct {
	GlobalContext                *contexts.ContextSet
	Configs                      map[string]interface{}
	APIKey                       string
	APIURLs                      []string
	Sources                      []ConfigSource
	EnvironmentNames             []string
	ProjectEnvID                 int64
	InitializationTimeoutSeconds float64
	OnInitializationFailure      OnInitializationFailure
	ContextTelemetryMode         ContextTelemetryMode
	CollectEvaluationSummaries   bool
	TelemetrySyncInterval        time.Duration
	TelemetryHost                string
	InstanceHash                 string
	CustomEnvLookup              EnvLookup
}

func GetDefaultOptions

func GetDefaultOptions() Options

func (*Options) APIKeySettingOrEnvVar

func (o *Options) APIKeySettingOrEnvVar() (string, error)

func (*Options) PrefabAPIURLEnvVarOrSetting

func (o *Options) PrefabAPIURLEnvVarOrSetting() ([]string, error)

func (*Options) TelemetryEnabled added in v0.0.9

func (o *Options) TelemetryEnabled() bool

type RealEnvLookup added in v0.3.0

type RealEnvLookup struct{}

RealEnvLookup implements EnvLookup using os.LookupEnv

func (RealEnvLookup) LookupEnv added in v0.3.0

func (RealEnvLookup) LookupEnv(key string) (string, bool)

type StoreType

type StoreType string
const (
	APIStore   StoreType = "API"
	DataFile   StoreType = "DataFile"
	ConfigDump StoreType = "ConfigDump"
	Memory     StoreType = "Memory"

	MemoryStoreKey = "memory://configs"
)

Jump to

Keyboard shortcuts

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