xcfg

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer added in v0.3.1

type Buffer = types.NDict

type JsonConfig

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

json file config

func NewJsonConfig

func NewJsonConfig(filepath string, defaults map[string]any) *JsonConfig

create new json config file handler

func (JsonConfig) EnableBackup added in v0.3.1

func (cfg JsonConfig) EnableBackup(bakpath string)

enable config file backup support

func (JsonConfig) GetSecure added in v0.3.1

func (cfg JsonConfig) GetSecure(key string, defval any) (any, error)

get secure value from config by key

func (JsonConfig) InitAES128 added in v0.3.2

func (cfg JsonConfig) InitAES128(secret string) error

func (JsonConfig) InitAES256 added in v0.3.2

func (cfg JsonConfig) InitAES256(secret string) error

func (JsonConfig) IsBackupExist added in v0.3.1

func (cfg JsonConfig) IsBackupExist() bool

check backup config file exist on disk, if backup support enabled.

func (JsonConfig) IsExist added in v0.3.1

func (cfg JsonConfig) IsExist() bool

check config file exist on disk

func (JsonConfig) Load

func (cfg JsonConfig) Load() error

read raw bytes content of config file, if error: then check and read the backup file if backup support enabled.

func (JsonConfig) Purge added in v0.3.1

func (cfg JsonConfig) Purge() error

delete config and backup files from disk and reset local buffer

func (JsonConfig) Reset added in v0.3.1

func (cfg JsonConfig) Reset()

reset local buffer

func (JsonConfig) Save

func (cfg JsonConfig) Save() error

write raw bytes content to config file, if not error: then check and write backup config if backup support enabled.

func (JsonConfig) SetSecure added in v0.3.1

func (cfg JsonConfig) SetSecure(key string, val any) error

set secure value in config by key, creates key if not exist

Jump to

Keyboard shortcuts

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