settings

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

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

func LogFile added in v0.1.5

func LogFile(job string, kind string) string

func OpenLogFile added in v0.1.5

func OpenLogFile(job string, kind string) (*os.File, error)

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