vegvisir/server/server.go

32 lines
401 B
Go
Raw Normal View History

2021-07-08 22:32:49 +02:00
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
}