-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to push to eventhubs in an asynchronous way
`PEERDB_BETA_EVENTHUB_PUSH_ASYNC=true` enables this
- Loading branch information
1 parent
5b6b8df
commit e8060ad
Showing
4 changed files
with
120 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package utils | ||
|
||
import ( | ||
"os" | ||
"strconv" | ||
) | ||
|
||
// GetEnv returns the value of the environment variable with the given name | ||
// and a boolean indicating whether the environment variable exists. | ||
func GetEnv(name string) (string, bool) { | ||
val, exists := os.LookupEnv(name) | ||
return val, exists | ||
} | ||
|
||
// GetEnvBool returns the value of the environment variable with the given name | ||
// or defaultValue if the environment variable is not set or is not a valid | ||
// boolean value. | ||
func GetEnvBool(name string, defaultValue bool) bool { | ||
val, ok := GetEnv(name) | ||
if !ok { | ||
return defaultValue | ||
} | ||
|
||
b, err := strconv.ParseBool(val) | ||
if err != nil { | ||
return defaultValue | ||
} | ||
|
||
return b | ||
} |