Skip to content

Commit

Permalink
Make WHITELIST env optional
Browse files Browse the repository at this point in the history
  • Loading branch information
sw00 committed Oct 14, 2018
1 parent 6242e5c commit 7e1430b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
accessToken = getenv("TWITTER_ACCESS_TOKEN")
accessTokenSecret = getenv("TWITTER_ACCESS_TOKEN_SECRET")
maxTweetAge = getenv("MAX_TWEET_AGE")
whitelist = strings.Split(getenv("WHITELIST"), ":")
whitelist = getWhitelist()
)

func getenv(name string) string {
Expand All @@ -30,6 +30,16 @@ func getenv(name string) string {
return v
}

func getWhitelist() []string {
v := os.Getenv("WHITELIST")

if v == "" {
return make([]string, 0)
}

return strings.Split(v, ":")
}

func getTimeline(api *anaconda.TwitterApi) ([]anaconda.Tweet, error) {
args := url.Values{}
args.Add("count", "200") // Twitter only returns most recent 20 tweets by default, so override
Expand Down

0 comments on commit 7e1430b

Please sign in to comment.