Add project files

This commit is contained in:
ChaoticByte 2024-06-29 09:38:07 +02:00
parent d93b571440
commit 2dd8f72714
No known key found for this signature in database
9 changed files with 260 additions and 1 deletions

24
config.go Normal file
View file

@ -0,0 +1,24 @@
package main
// Copyright (c) 2024 Julian Müller (ChaoticByte)
// License: MIT
import (
"log"
"os"
"github.com/goccy/go-yaml"
)
var config struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Clients map[string]string `yaml:"clients"`
}
func ParseConfig(filepath string) {
data, err := os.ReadFile(filepath)
if err != nil { log.Fatal(err) }
err = yaml.Unmarshal(data, &config)
if err != nil { log.Fatal(err) }
}