mu-config

module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT

README

muConfig

Libreria leggera per la gestione dei settings.

  • Supporta i formati Json, Jsonc (json con commenti), Yaml, Toml;

  • Supporta il load multiplo a mo' di override.

  • Salva le sole differenze rispetto ai valori di default.

Note

  • Go: i nomi delle variabili nelle struct di configurazione devono obbligatoriamente iniziare per lettera maiuscola.

  • Json/c, Yaml, Toml: i nomi variabili nelle struct di configurazione sono case insensitive.

  • L'utilizzo dei tag json:"..", toml:"..", yaml:".." non è consentito, sia per la scomodità di doverli esprimere sempre tutti e quindi per l'immantenibilità nel caso di subentro nuovi parser, sia perchè l'exporter non li supporta.

  • I decoder sono configurati in modalità strict, ovvero ritornano errore nel caso di field presenti nei file di configurazione ma mancanti nella struct destinataria in Go.

Utilizzo

Vedi examples/.

TODO

  • go2cfg yaml/toml

  • testare il caricamento con systemd

Directories

Path Synopsis
examples module
distiller
Package distiller extracts only the necessary information from the AST, making it easy to access the names and documentation of structs, fields, and constants.
Package distiller extracts only the necessary information from the AST, making it easy to access the names and documentation of structs, fields, and constants.
generator
Package generator generates code from the information extracted from the AST via the distiller package.
Package generator generates code from the information extracted from the AST via the distiller package.
ordered
Package ordered implements a simple ordered map to ensure that the insertion order in the elements of a map is maintained.
Package ordered implements a simple ordered map to ensure that the insertion order in the elements of a map is maintained.
json2struct module

Jump to

Keyboard shortcuts

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