Notes/config.go
2023-06-15 07:24:23 +02:00

34 lines
482 B
Go

package main
import (
// External
"gopkg.in/yaml.v3"
// Standard
"io/ioutil"
)
type Config struct {
Websocket struct {
Domains []string
}
Database struct {
Host string
Port int
Name string
Username string
Password string
}
}
func ConfigRead(filename string) (config Config, err error) {
var rawConfigData []byte
rawConfigData, err = ioutil.ReadFile(filename)
if err != nil { return }
err = yaml.Unmarshal(rawConfigData, &config)
return
}