mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-16 12:42:42 +00:00
30 lines
439 B
Go
30 lines
439 B
Go
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
||
|
|
|
||
|
|
//go:build !plan9
|
||
|
|
|
||
|
|
package apiproxy
|
||
|
|
|
||
|
|
import (
|
||
|
|
"os"
|
||
|
|
|
||
|
|
"tailscale.com/types/opt"
|
||
|
|
)
|
||
|
|
|
||
|
|
func defaultBool(envName string, defVal bool) bool {
|
||
|
|
vs := os.Getenv(envName)
|
||
|
|
if vs == "" {
|
||
|
|
return defVal
|
||
|
|
}
|
||
|
|
v, _ := opt.Bool(vs).Get()
|
||
|
|
return v
|
||
|
|
}
|
||
|
|
|
||
|
|
func defaultEnv(envName, defVal string) string {
|
||
|
|
v := os.Getenv(envName)
|
||
|
|
if v == "" {
|
||
|
|
return defVal
|
||
|
|
}
|
||
|
|
return v
|
||
|
|
}
|