busdepartures/config.go

23 lines
324 B
Go

package main
import (
"github.com/BurntSushi/toml"
"os"
)
type Config struct {
Quays []Quay
}
func ReadConfigFromFile(filename string) (Config, error) {
var conf Config
contents, err := os.ReadFile(filename)
if err != nil {
return conf, err
}
_, err = toml.Decode(string(contents), &conf)
return conf, err
}