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

41 lines
988 B
Go

package setup
/* ---------------------------------------------------------------- *
* IMPORTS
* ---------------------------------------------------------------- */
import (
"ads/internal/types"
"gopkg.in/yaml.v3"
)
/* ---------------------------------------------------------------- *
* 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
}