settings

package module
v0.0.0-...-09e5c8a Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileFullPath

func GetFileFullPath(filename string) (string, error)

Ritorna il nome file completo di percorso assoluto.

  • filename: se non ha percorso o lo ha relativo, sarà rispetto alla directory corrente; se ha percorso assoluto può anche iniziare per '~'.

func LoadFile

func LoadFile(filename string, cfg interface{}, errorWhenNotFound bool) (loadedFilename string, err error)

Carica la configurazione da file.

  • filename: se non ha percorso o lo ha relativo, sarà rispetto alla directory corrente; se ha percorso assoluto può anche iniziare per '~'. Se sprovvisto di estensione tenta il caricamento di qualsiasi formato conosciuto.
  • cfg: PUNTATORE a struttura configurazione da popolare.

- errorWhenNotFound: true per generare un errore se il file non viene trovato.

func LoadSystemdCredentials

func LoadSystemdCredentials(filename string, cfg interface{}, errorWhenNotFound bool) (loadedFilename string, err error)

Carica la configurazione da Systemd. ref: https://systemd.io/CREDENTIALS/

  • filename: deve essere un nome file, sprovvisto di percorso assoluto, situato in $CREDENTIALS_DIRECTORY. L'estensione viene ignorata, tentando il carimento di qualsiasi formato conosciuto.
  • cfg: PUNTATORE a struttura configurazione da popolare.
  • errorWhenNotFound: true per generare un errore se il file non viene trovato o se $CREDENTIALS_DIRECTORY non è settato.

func SaveFile

func SaveFile(filename string, cfg interface{}, defaults interface{}) error

Salva la configurazione su file.

  • filename: se non ha percorso o lo ha relativo, sarà rispetto alla directory corrente; se ha percorso assoluto può anche iniziare per '~'.
  • cfg: struttura configurazione da salvare.
  • defaults: (opzionale) struttura configurazione di default. se passata il file conterrà i soli valori che differiscono da questa struttura.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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