options

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 6 Imported by: 0

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 DefaultOptions = Options{
	APIKey:                       "",
	APIUrl:                       "https://api.prefab.cloud",
	Datasource:                   ALL,
	InitializationTimeoutSeconds: timeoutDefault,
	OnInitializationFailure:      RAISE,
	EnvironmentNames:             getDefaultEnvironmentNames(),
	ConfigDirectory:              getHomeDir(),
	ConfigOverrideDirectory:      StringPtr("."),
	GlobalContext:                contexts.NewContextSet(),
}

Functions

func StringPtr

func StringPtr(str string) *string

Types

type Datasource

type Datasource int
const (
	ALL Datasource = iota
)

type OnInitializationFailure

type OnInitializationFailure int
const (
	RAISE  OnInitializationFailure = iota // RAISE = 0
	UNLOCK                                // UNLOCK = 1
)

type Options

type Options struct {
	ConfigDirectory              *string
	ConfigOverrideDirectory      *string
	GlobalContext                *contexts.ContextSet
	APIKey                       string
	APIUrl                       string
	EnvironmentNames             []string
	Datasource                   Datasource
	InitializationTimeoutSeconds float64
	OnInitializationFailure      OnInitializationFailure
}

func NewOptions

func NewOptions(modifyFn func(*Options)) Options

func (*Options) APIKeySettingOrEnvVar

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

func (*Options) PrefabAPIURLEnvVarOrSetting

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

Jump to

Keyboard shortcuts

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