MeteorLight/config.go
DataHoarder 7f8274f431
All checks were successful
continuous-integration/drone/push Build is passing
Implemented timeouts, audio sample buffers, and fast-start depending on client
2022-03-03 15:00:34 +01:00

37 lines
934 B
Go

package main
import "github.com/BurntSushi/toml"
type Config struct {
Api struct {
Host string `toml:"host"`
Port int `toml:"port"`
} `toml:"api"`
Queue struct {
RandomSongApi string `toml:"random_song_api"`
NowPlaying string `toml:"np"`
NowRandom string `toml:"nr"`
FallbackPath string `toml:"fallback"`
BufferLengthInKiB int `toml:"buffer_len"`
BufferSeconds int `toml:"buffer_size"`
} `toml:"queue"`
Radio struct {
Port int `toml:"port"`
Name string `toml:"name"`
} `toml:"radio"`
Streams []struct {
MountPath string `toml:"mount"`
Container string `toml:"container"`
Bitrate interface{} `toml:"bitrate"`
Codec string `toml:"codec"`
} `toml:"streams"`
}
func GetConfig(pathName string) (*Config, error) {
config := &Config{}
if _, err := toml.DecodeFile(pathName, config); err != nil {
return nil, err
}
return config, nil
}