vegvisir/server/server.go
2021-07-09 18:30:18 +02:00

32 lines
401 B
Go

package server
import (
"encoding/json"
"io/ioutil"
"os"
"vegvisir/config"
)
type Server struct {
Config config.Config
}
func NewServer() Server {
return Server{}
}
func (s *Server) LoadConfig(file string) error {
if _, err := os.Stat(file); err != nil {
return err
}
data, err := ioutil.ReadFile(file)
if err != nil {
return err
}
json.Unmarshal(data, &s.Config)
return nil
}