mirror of
https://github.com/cgzirim/seek-tune.git
synced 2025-12-19 09:54:22 +00:00
write function to get env variables
This commit is contained in:
parent
e4d6a099eb
commit
9332b06003
1 changed files with 12 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -15,3 +16,14 @@ func GenerateUniqueID() uint32 {
|
||||||
func GenerateSongKey(songTitle, songArtist string) string {
|
func GenerateSongKey(songTitle, songArtist string) string {
|
||||||
return songTitle + "---" + songArtist
|
return songTitle + "---" + songArtist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetEnv(key string, fallback ...string) string {
|
||||||
|
if value, ok := os.LookupEnv(key); ok {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(fallback) > 0 {
|
||||||
|
return fallback[0]
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue