From 07ac74ca460e641dc33370df6e35cfcc6bda2d0f Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Fri, 2 Sep 2022 09:33:45 +0200 Subject: [PATCH] Add Host configuration to radio endpoint --- MeteorLight.go | 2 +- config.go | 1 + example_config.toml | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/MeteorLight.go b/MeteorLight.go index 9ea39bc..281135d 100644 --- a/MeteorLight.go +++ b/MeteorLight.go @@ -28,7 +28,7 @@ func main() { defer wg.Done() server := http.Server{ - Addr: fmt.Sprintf(":%d", config.Radio.Port), + Addr: fmt.Sprintf("%s:%d", config.Radio.Host, config.Radio.Port), Handler: http.HandlerFunc(queue.HandleRadioRequest), } server.SetKeepAlivesEnabled(false) diff --git a/config.go b/config.go index d167aed..111afdd 100644 --- a/config.go +++ b/config.go @@ -26,6 +26,7 @@ type Config struct { BitDepth int `toml:"bitdepth"` } `toml:"queue"` Radio struct { + Host string `toml:"host"` Port int `toml:"port"` Name string `toml:"name"` Description string `toml:"description"` diff --git a/example_config.toml b/example_config.toml index 0d52628..a8aaeb7 100644 --- a/example_config.toml +++ b/example_config.toml @@ -71,8 +71,10 @@ replaygain=false [radio] # -# The port to stream actual audio on. MeteorLight will listen on localhost. +# The HTTP port to stream actual audio on. port=8001 +# The HTTP bind address to stream actual audio on. +host="127.0.0.1" # Name of the stream. name="my radio" # Description of the stream.