X-Git-Url: https://code.octet-stream.net/broadcaster/blobdiff_plain/8320951221d45c5f5f3d387c5cb4b97d9fa2094c..33a19d553807d171f6ba9f4dafe30f43bc4bab5e:/server/config.go diff --git a/server/config.go b/server/config.go deleted file mode 100644 index 4a4866c..0000000 --- a/server/config.go +++ /dev/null @@ -1,45 +0,0 @@ -package main - -import ( - "errors" - "log" - - "github.com/BurntSushi/toml" -) - -type ServerConfig struct { - BindAddress string - Port int - SqliteDB string - AudioFilesPath string -} - -func NewServerConfig() ServerConfig { - return ServerConfig{ - BindAddress: "0.0.0.0", - Port: 55134, - SqliteDB: "", - AudioFilesPath: "", - } -} - -func (c *ServerConfig) LoadFromFile(path string) { - _, err := toml.DecodeFile(path, &c) - if err != nil { - log.Fatal("could not read config file for reading at path:", path, err) - } - err = c.Validate() - if err != nil { - log.Fatal(err) - } -} - -func (c *ServerConfig) Validate() error { - if c.SqliteDB == "" { - return errors.New("Configuration must provide SqliteDB") - } - if c.AudioFilesPath == "" { - return errors.New("Configuration must provide AudioFilesPath") - } - return nil -}