Mainflux.mainflux/env.go

21 lines
321 B
Go

//
// Copyright (c) 2018
// 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
}