2021-10-30 10:19:16 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* IMPORTS
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
import (
|
|
|
|
"embed"
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"ads/internal/core/logging"
|
|
|
|
"ads/internal/endpoints"
|
|
|
|
"ads/internal/setup"
|
|
|
|
"ads/internal/setup/cli"
|
|
|
|
"ads/internal/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* GLOBAL VARIABLES
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
var (
|
|
|
|
// !!! NOTE: do not remove the following "comment", as it is a preprocessing instruction !!!
|
|
|
|
//go:embed assets/*
|
|
|
|
res embed.FS
|
|
|
|
assets = map[string]string{
|
2021-11-02 09:07:04 +01:00
|
|
|
"appconfig": "assets/config.yml",
|
|
|
|
"version": "assets/VERSION",
|
|
|
|
"logo": "assets/LOGO",
|
|
|
|
"help": "assets/HELP",
|
2021-10-30 10:19:16 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------- *
|
|
|
|
* METHOD main
|
|
|
|
* ---------------------------------------------------------------- */
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
var err error
|
|
|
|
var arguments *types.CliArguments
|
|
|
|
|
2021-11-02 09:07:04 +01:00
|
|
|
// assets festlegen
|
2021-10-30 10:19:16 +02:00
|
|
|
setup.Res = res
|
|
|
|
setup.Assets = assets
|
|
|
|
|
2021-11-02 09:07:04 +01:00
|
|
|
// cli arguments parsen
|
2021-10-30 10:19:16 +02:00
|
|
|
arguments, err = cli.ParseCli(os.Args)
|
|
|
|
|
2021-11-02 09:07:04 +01:00
|
|
|
// initialisiere basic optionen wie Logging
|
2021-10-30 10:19:16 +02:00
|
|
|
if err == nil {
|
2021-11-02 09:07:04 +01:00
|
|
|
logging.SetQuietMode(arguments.QuietModeOn())
|
|
|
|
logging.SetDebugMode(arguments.DebugModeOn())
|
2021-10-30 10:19:16 +02:00
|
|
|
logging.SetAnsiMode(arguments.ShowColour())
|
|
|
|
}
|
|
|
|
|
2021-11-02 09:07:04 +01:00
|
|
|
// app config (intern) intialisieren
|
|
|
|
if err == nil {
|
|
|
|
err = setup.AppConfigInitialise()
|
|
|
|
}
|
|
|
|
|
|
|
|
if err == nil {
|
|
|
|
setup.AppConfig.Options.Checks = arguments.ShowChecks()
|
|
|
|
}
|
|
|
|
|
2021-10-30 10:19:16 +02:00
|
|
|
if err == nil {
|
|
|
|
if arguments.Version.Happened() {
|
|
|
|
endpoints.Version()
|
|
|
|
} else if arguments.Run.Happened() {
|
2021-11-02 09:07:04 +01:00
|
|
|
err = endpoints.Run(arguments.GetConfigFile())
|
2021-10-30 10:19:16 +02:00
|
|
|
} else { // } else if arguments.Help.Happened() {
|
|
|
|
endpoints.Help()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
logging.LogFatal(err)
|
|
|
|
}
|
|
|
|
}
|