ads1_2021/code/golang/internal/setup/setup_appconfig.go

41 lines
988 B
Go
Raw Normal View History

package setup
/* ---------------------------------------------------------------- *
* IMPORTS
* ---------------------------------------------------------------- */
import (
"gopkg.in/yaml.v3"
"ads/internal/types"
)
/* ---------------------------------------------------------------- *
* GLOBAL CONSTANTS
* ---------------------------------------------------------------- */
var AppConfig = types.AppConfig{}
/* ---------------------------------------------------------------- *
* METHODS
* ---------------------------------------------------------------- */
// Extrahiert Inhalte einer YAML Config und parset dies als Struktur
func AppConfigInitialise() error {
contents := AppConfigYaml()
err := yaml.Unmarshal([]byte(contents), &AppConfig)
return err
}
func AppConfigFancyMode() bool {
return AppConfig.Options.Display
}
func AppConfigShowMetrics() bool {
return AppConfig.Options.Metrics
}
func AppConfigPerformChecks() bool {
return AppConfig.Options.Checks
}