File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 66
77package main
88
9+ import (
10+ "fmt"
11+ "log"
12+ "os"
13+ )
14+
915type envVars struct {
1016 appID string
1117 appSecret string
1218 userName string
1319 userPassword string
1420}
1521
22+ func arrayHasNoEmptyStrings (envVars []string ) bool {
23+ for _ , value := range envVars {
24+ if value == "" {
25+ return false
26+ }
27+ }
28+
29+ return true
30+ }
31+
1632func main () {
33+ e := envVars {
34+ os .Getenv ("REDDIT_APP_ID" ),
35+ os .Getenv ("REDDIT_SECRET" ),
36+ os .Getenv ("REDDIT_USER_ID" ),
37+ os .Getenv ("REDDIT_USER_PASSWORD" ),
38+ }
1739
40+ if ! arrayHasNoEmptyStrings ([]string {e .appID , e .appSecret , e .userName , e .userPassword }) {
41+ log .Fatal (fmt .Errorf ("one of the last.fm environment variables is not present in your system" ))
42+ }
1843}
You can’t perform that action at this time.
0 commit comments