Skip to content

Commit

Permalink
Move to os.Getenv
Browse files Browse the repository at this point in the history
  • Loading branch information
film42 committed Oct 11, 2018
1 parent 8ec1294 commit 1c6dee5
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 32 deletions.
6 changes: 2 additions & 4 deletions _examples/accounts_and_transactions.go
Expand Up @@ -9,13 +9,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/all_endpoints.go
Expand Up @@ -10,13 +10,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/create_a_user.go
Expand Up @@ -8,13 +8,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/example_workflow.go
Expand Up @@ -15,13 +15,11 @@ import (
var counter = 0

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/multi_factor_authentication.go
Expand Up @@ -9,13 +9,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/mxbank.go
Expand Up @@ -9,13 +9,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/update_credentials.go
Expand Up @@ -9,13 +9,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down
6 changes: 2 additions & 4 deletions _examples/user_and_member_creation.go
Expand Up @@ -8,13 +8,11 @@ import (
)

func getEnv(key string) string {
value, isPresent := os.LookupEnv(key)

if !isPresent {
value := os.Getenv(key)
if len(value) == 0 {
fmt.Println("You need to set the", key, "as an environment variable.")
os.Exit(1)
}

return value
}

Expand Down

0 comments on commit 1c6dee5

Please sign in to comment.