2022-04-22 17:38:40 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/photoprism/photoprism/pkg/list"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Environment names.
|
|
|
|
const (
|
2022-04-22 18:24:59 +02:00
|
|
|
EnvUnsafe = "unsafe"
|
2022-04-22 17:38:40 +02:00
|
|
|
EnvDebug = "debug"
|
|
|
|
EnvTrace = "trace"
|
|
|
|
EnvDemo = "demo"
|
|
|
|
EnvSponsor = "sponsor"
|
|
|
|
EnvTest = "test"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Env checks the presence of environment and command-line flags.
|
|
|
|
func Env(vars ...string) bool {
|
|
|
|
for _, s := range vars {
|
|
|
|
if os.Getenv("PHOTOPRISM_"+strings.ToUpper(s)) == "true" || list.Contains(os.Args, "--"+s) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|