Add project files
This commit is contained in:
parent
d93b571440
commit
2dd8f72714
9 changed files with 260 additions and 1 deletions
24
config.go
Normal file
24
config.go
Normal 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) }
|
||||
}
|
Reference in a new issue