config

package
v0.0.0-...-b4c4296 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config provides APIs for managing the shell's runtime config

Index

Constants

This section is empty.

Variables

View Source
var InitConf = newGlobal()

InitConf is a table of global config options

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is used to store all the configuration settings, `config`, in a thread-safe API

func (*Config) Copy

func (conf *Config) Copy() *Config

Copy creates a new *Config instance referenced to the parent

func (*Config) DataType

func (conf *Config) DataType(app, key string) string

DataType retrieves the murex data type for a given Config property

func (*Config) Default

func (conf *Config) Default(app string, key string, fileRef *ref.File) error

Default resets a config option back to its default

func (*Config) Define

func (conf *Config) Define(app string, key string, properties Properties)

Define allows new properties to be created in the Config object

func (*Config) DumpConfig

func (conf *Config) DumpConfig() (obj map[string]map[string]map[string]any)

DumpConfig returns an object based on Config which is optimised for JSON serialisation for the `config` CLI command

func (*Config) DumpRuntime

func (conf *Config) DumpRuntime() (obj map[string]map[string]map[string]any)

DumpRuntime returns an object based on Config which is optimised for JSON serialisation for the `runtime --config` CLI command

func (*Config) ExistsAndGlobal

func (conf *Config) ExistsAndGlobal(app, key string) (exists, global bool)

ExistsAndGlobal checks if a config option exists and/or is global

func (*Config) Get

func (conf *Config) Get(app, key, dataType string) (any, error)

Get retrieves a setting from the Config. Returns an interface{} for the value and err for any failures

app == tooling name
key == name of setting
dataType == what `types.dataType` to cast the return value into

func (*Config) GetFileRef

func (conf *Config) GetFileRef(app, key, dataType string) (any, *ref.File, error)

GetFileRef retrieves a setting from the Config. Returns an interface{} for the value and err for any failures

func (*Config) Set

func (conf *Config) Set(app string, key string, value any, fileRef *ref.File) error

Set changes a setting in the Config object

app == tooling name
key == name of setting
value == the setting itself

type DynamicProperties

type DynamicProperties struct {
	Read       string
	Write      string
	GetDynamic getDynamicT `json:"-"`
	SetDynamic setDynamicT `json:"-"`
}

DynamicProperties is used for dynamic values written in murex

type GoFuncProperties

type GoFuncProperties struct {
	Read  func() (any, error) `json:"-"`
	Write func(any) error     `json:"-"`
}

GoFuncProperties are used for dynamic values written in Go

type Properties

type Properties struct {
	Description string
	Default     any
	DataType    string
	Options     []string
	Global      bool
	Dynamic     DynamicProperties
	GoFunc      GoFuncProperties
	FileRefDef  *ref.File
}

Properties is the Config defaults and descriptions

Directories

Path Synopsis
Package defaults defines the default state for many run time config
Package defaults defines the default state for many run time config
Package profile is used to read the various non-default murex user profiles and modules
Package profile is used to read the various non-default murex user profiles and modules

Jump to

Keyboard shortcuts

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