MeteorLight/config.go
DataHoarder 5eda50e5b7
All checks were successful
continuous-integration/drone/push Build is passing
Added radio metadata improvements, changed HTTP headers
2022-03-07 16:19:38 +01:00

42 lines
1.1 KiB
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"`
ReplayGain bool `toml:"replaygain"`
} `toml:"queue"`
Radio struct {
Port int `toml:"port"`
Name string `toml:"name"`
Description string `toml:"description"`
URL string `toml:"url"`
Logo string `toml:"logo"`
Private bool `toml:"private"`
} `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
}