Mainflux.mainflux/env.go

19 lines
309 B
Go

// Copyright (c) Mainflux
// SPDX-License-Identifier: Apache-2.0
package mainflux
import (
"os"
)
// Env reads specified environment variable. If no value has been found,
// fallback is returned.
func Env(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}