userconfig

package
v1.46.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CLIDocs

func CLIDocs() string

func Keys

func Keys() []string

func MarkdownDocs

func MarkdownDocs() string

func RenderOneof

func RenderOneof(oneof []any) string

func RenderValue

func RenderValue(v any) string

func SetForApp

func SetForApp(appRoot, key, value string) error

func SetGlobal

func SetGlobal(key, value string) error

Types

type Cached

type Cached = goldfish.Cache[*Config]

func ForApp

func ForApp(appRoot string) *Cached

func Global

func Global() *Cached

type Config

type Config struct {
	// Whether to open the Local Development Dashboard in the browser on `encore run`.
	// If set to "auto", the browser will be opened if the dashboard is not already open.
	RunBrowser string `koanf:"run.browser" oneof:"always,never,auto" default:"auto"`
}

Config describes the configuration structure we support.

func (*Config) GetByKey

func (c *Config) GetByKey(key string) (v Value, ok bool)

func (*Config) Render

func (c *Config) Render() string

type Kind

type Kind int
const (
	String Kind = iota + 1
	Bool
	Int
	Uint
)

func KindOf

func KindOf[T interface{ string | bool | int | uint }](val T) (k Kind, ok bool)

func (Kind) HumanString

func (k Kind) HumanString() string

func (Kind) String

func (k Kind) String() string

type Type

type Type struct {
	Kind    Kind
	Default *any  // nil means no default
	Oneof   []any // nil means no restrictions
}

func GetType

func GetType(key string) (Type, bool)

func (Type) ParseAndValidate

func (t Type) ParseAndValidate(val string) (any, error)

type Value

type Value struct {
	Val  any
	Type Type
}

func (Value) String

func (v Value) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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