config

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextProduction  = "production"
	ContextPlatform    = "platform"
	ContextPlayground  = "playground"
	ContextDevelopment = "development"
	ContextPlatform2   = "platform2"

	DefaultCacheDuration = 7 * 24 * time.Hour
)

Variables

View Source
var (
	RadixConfigDir          = path.Join(getUserHomeDir(), radixConfigDir)
	RadixConfigFileFullName = path.Join(RadixConfigDir, radixConfigFileName)
	ValidContexts           = []string{ContextProduction, ContextPlatform, ContextPlatform2, ContextPlayground, ContextDevelopment}
)

Functions

func GetAppNameFromConfigOrFromParameter added in v1.21.0

func GetAppNameFromConfigOrFromParameter(cmd *cobra.Command, appNameField string) (string, error)

func GetCache added in v1.21.0

func GetCache[T any](key string) (content T, ok bool)

func GetEnvironmentFromConfig added in v1.21.0

func GetEnvironmentFromConfig(cmd *cobra.Command, branchName string) (string, error)

func GetRadixApplicationFromFile added in v1.21.0

func GetRadixApplicationFromFile() (*v1.RadixApplication, error)

func GetStringFromFlagValueOrFlagFile added in v1.21.0

func GetStringFromFlagValueOrFlagFile(cmd *cobra.Command, valueFlag, fileNameFlag string) (string, error)

func IsValidContext

func IsValidContext(context string) bool

func Save added in v1.0.7

func Save(radixConfig *RadixConfig) error

Save Saves RadixConfig

func SetCache added in v1.21.0

func SetCache[T any](key string, content T, ttl time.Duration)

Types

type CacheItem added in v1.21.0

type CacheItem struct {
	UpdatedAt time.Time `json:"updated_at"`
	ExpiresAt time.Time `json:"expires_at"`
	Content   string    `json:"content"`
}

type CustomConfig

type CustomConfig struct {
	// Context is the environment context: platform (default), playground, development, platform2
	Context string `json:"Context"`
}

CustomConfig is the custom environment config

type RadixConfig

type RadixConfig struct {
	// CustomConfig is the custom environment config
	CustomConfig *CustomConfig                   `json:"customConfig"`
	Cache        map[string]map[string]CacheItem `json:"cache"`

	// MSAL is the internal cache structure used by the MSAL module. The content is base64 encoded
	MSAL string `json:"msal,omitempty"`
}

func GetDefaultRadixConfig added in v1.0.7

func GetDefaultRadixConfig() *RadixConfig

func GetRadixConfig added in v1.8.0

func GetRadixConfig() (*RadixConfig, error)

Jump to

Keyboard shortcuts

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