diff --git a/cmd/stream-server/main.go b/cmd/stream-server/main.go index 29c59130191688fa7a07140ddb8736faa2043aab..ca793306eca7419549ada13238a7c4f9483d8fdc 100644 --- a/cmd/stream-server/main.go +++ b/cmd/stream-server/main.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + streamserver "stream-server" "github.com/urfave/cli" @@ -24,7 +25,7 @@ func main() { app.Usage = docURL app.HideHelp = true - app.Version = server.Version + app.Version = streamserver.Version app.Flags = []cli.Flag{ cli.IntFlag{ diff --git a/config.go b/config.go new file mode 100644 index 0000000000000000000000000000000000000000..d307b38959393d650308ed099aa7ccbc803ad048 --- /dev/null +++ b/config.go @@ -0,0 +1,10 @@ +package streamserver + +// For pager to work we need at least one .go file in the main folder so thats why this exists :) + +// Version will automatically be set by the CI pipeline. +var Version = "dev" + +// DefaultTwitchClientID will automatically be set by the CI pipeline. +// for local builds the TWITCH_CLIENT_ID environment variable must be set +var DefaultTwitchClientID = "" diff --git a/internal/server/server.go b/internal/server/server.go index 1ca5048857c44d43db8a6ff6ac1133323adefc22..238afbfa184740433a3e6ed50ba46e4319943d5d 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -7,9 +7,6 @@ import ( "github.com/markbates/pkger" ) -// Version will automatically be set by the CI pipeline. -var Version = "dev" - // ListenAndServe will listen and serve on the provided listenAddr func ListenAndServe(listenAddr string) error { r := chi.NewRouter() diff --git a/internal/server/twitch.go b/internal/server/twitch.go index a2eb5699151e0ba5a7ab0e7719f40358ee3c1286..93a28098baa040d15a36af40fd35098fc15a2295 100644 --- a/internal/server/twitch.go +++ b/internal/server/twitch.go @@ -3,6 +3,7 @@ package server import ( "net/http" "os" + streamserver "stream-server" "stream-server/internal/util" "stream-server/pkg/twitch" @@ -11,17 +12,13 @@ import ( // client is the Twitch Client instance var client *twitch.Client -// defaultTwitchClientID will automatically be set by the CI pipeline. -// for local builds the TWITCH_CLIENT_ID environment variable must be set -var defaultTwitchClientID string - func init() { // If you want to use your own twitch client id set the TWITCH_CLIENT_ID environment variable. if twitchClientID := os.Getenv("TWITCH_CLIENT_ID"); twitchClientID != "" { client = twitch.NewClient(twitchClientID) } else { - client = twitch.NewClient(defaultTwitchClientID) + client = twitch.NewClient(streamserver.DefaultTwitchClientID) } }