settings

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Home = sync.OnceValue(func() string {
	if home, ok := os.LookupEnv("GOSUHOME"); ok {
		return home
	} else {
		userDir, _ := os.UserHomeDir()
		return filepath.Join(userDir, ".gosu")
	}
})

Home directory.

View Source
var Javascript = Settings(js{
	Engine:     "node",
	Transpiler: "tsx",
})
View Source
var Rpc = Settings(rpc{
	LocalAddress:    "http://localhost:24511",
	RemoteAddresses: []string{},
	Secret:          fastRandom(),
	Seed:            fastRandom(),
})
View Source
var Service = Settings(service{
	Ephemeral: false,
})

Functions

This section is empty.

Types

type Instance

type Instance[T any] interface {
	Reload() (*T, error)
	Save(T) error
	Get() *T
	Path() string
}

Settings interface.

func Settings

func Settings[T any](defaults T) Instance[T]

type Subdir

type Subdir string

Subdirectories.

const (
	LogDir  Subdir = "log"
	DataDir Subdir = "db"
)

func (Subdir) Path

func (s Subdir) Path() string

Jump to

Keyboard shortcuts

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