Print deprecation notice when using unprefixed env var

This commit is contained in:
Dan Sosedoff 2022-11-22 15:20:49 -06:00
parent b1023cdcfd
commit a2a5415ace
No known key found for this signature in database
GPG Key ID: 26186197D282B164

View File

@ -2,6 +2,7 @@ package command
import (
"errors"
"fmt"
"os"
"os/user"
"strings"
@ -150,6 +151,9 @@ func getPrefixedEnvVar(name string) string {
val := os.Getenv(envVarPrefix + name)
if val == "" {
val = os.Getenv(name)
if val != "" {
fmt.Printf("[DEPRECATION] Usage of %s env var is deprecated, please use PGWEB_%s variable instead\n", name, name)
}
}
return val
}