From 1437edd55a989d1613bc8830a5b83fdd20731de9 Mon Sep 17 00:00:00 2001 From: speatzle Date: Thu, 25 Apr 2024 21:53:01 +0200 Subject: [PATCH] Initial commit --- go.mod | 5 +++++ go.sum | 2 ++ main.go | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 go.mod create mode 100644 go.sum create mode 100644 main.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..65df1c9 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.lastassault.de/speatzle/morffix + +go 1.21.8 + +require github.com/BurntSushi/toml v1.3.2 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ef0f966 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= diff --git a/main.go b/main.go new file mode 100644 index 0000000..9350d03 --- /dev/null +++ b/main.go @@ -0,0 +1,31 @@ +package main + +import ( + "log/slog" + "os" + + "github.com/BurntSushi/toml" +) + +type Config struct { + Server bool +} + +var conf Config + +func main() { + slog.Info("Starting...") + + confPath := "config.toml" + _, err := os.Stat(confPath) + if err != nil { + confPath = "/etc/morffix/config.toml" + } + + _, err = toml.DecodeFile(confPath, &conf) + if err != nil { + slog.Error("Error Loading Config", "err", err) + return + } + +}