Initial commit
This commit is contained in:
commit
1437edd55a
3 changed files with 38 additions and 0 deletions
5
go.mod
Normal file
5
go.mod
Normal file
|
@ -0,0 +1,5 @@
|
|||
module git.lastassault.de/speatzle/morffix
|
||||
|
||||
go 1.21.8
|
||||
|
||||
require github.com/BurntSushi/toml v1.3.2
|
2
go.sum
Normal file
2
go.sum
Normal file
|
@ -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=
|
31
main.go
Normal file
31
main.go
Normal file
|
@ -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
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue