Commit 2b927670 authored by Simon Kirsten's avatar Simon Kirsten
Browse files

Moved DefaultTwitchClientID and Version to config

parent 707d5f7d
......@@ -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{
......
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 = ""
......@@ -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()
......
......@@ -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)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment