api: use COMMENTO_ prefix on errors
Closes https://gitlab.com/commento/commento-ce/issues/44
This commit is contained in:
parent
0ee43ae52a
commit
a3a6f2ba68
@ -47,7 +47,7 @@ func parseConfig() error {
|
||||
// Mandatory config parameters
|
||||
for _, env := range []string{"POSTGRES", "PORT", "ORIGIN"} {
|
||||
if os.Getenv(env) == "" {
|
||||
logger.Errorf("missing %s environment variable", env)
|
||||
logger.Errorf("missing COMMENTO_%s environment variable", env)
|
||||
return errorMissingConfig
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func TestParseConfigBasics(t *testing.T) {
|
||||
}
|
||||
|
||||
if os.Getenv("BIND_ADDRESS") != "127.0.0.1" {
|
||||
t.Errorf("expected BIND_ADDRESS=127.0.0.1, but BIND_ADDRESS=%s instead", os.Getenv("BIND_ADDRESS"))
|
||||
t.Errorf("expected COMMENTO_BIND_ADDRESS=127.0.0.1, but COMMENTO_BIND_ADDRESS=%s instead", os.Getenv("BIND_ADDRESS"))
|
||||
return
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func TestParseConfigBasics(t *testing.T) {
|
||||
}
|
||||
|
||||
if os.Getenv("BIND_ADDRESS") != "192.168.1.100" {
|
||||
t.Errorf("expected BIND_ADDRESS=192.168.1.100, but BIND_ADDRESS=%s instead", os.Getenv("BIND_ADDRESS"))
|
||||
t.Errorf("expected COMMENTO_BIND_ADDRESS=192.168.1.100, but COMMENTO_BIND_ADDRESS=%s instead", os.Getenv("BIND_ADDRESS"))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,12 @@ func googleOauthConfigure() error {
|
||||
}
|
||||
|
||||
if os.Getenv("GOOGLE_KEY") == "" {
|
||||
logger.Errorf("GOOGLE_KEY not configured, but GOOGLE_SECRET is set")
|
||||
logger.Errorf("COMMENTO_GOOGLE_KEY not configured, but COMMENTO_GOOGLE_SECRET is set")
|
||||
return errorOauthMisconfigured
|
||||
}
|
||||
|
||||
if os.Getenv("GOOGLE_SECRET") == "" {
|
||||
logger.Errorf("GOOGLE_SECRET not configured, but GOOGLE_KEY is set")
|
||||
logger.Errorf("COMMENTO_GOOGLE_SECRET not configured, but COMMENTO_GOOGLE_KEY is set")
|
||||
return errorOauthMisconfigured
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ func TestGoogleOauthConfigureEmpty(t *testing.T) {
|
||||
os.Setenv("GOOGLE_KEY", "google-key")
|
||||
|
||||
if err := googleOauthConfigure(); err == nil {
|
||||
t.Errorf("expected error not found when configuring google oauth with empty GOOGLE_SECRET")
|
||||
t.Errorf("expected error not found when configuring google oauth with empty COMMENTO_GOOGLE_SECRET")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ func smtpConfigure() error {
|
||||
}
|
||||
|
||||
if os.Getenv("SMTP_FROM_ADDRESS") == "" {
|
||||
logger.Errorf("SMTP_FROM_ADDRESS not set")
|
||||
logger.Errorf("COMMENTO_SMTP_FROM_ADDRESS not set")
|
||||
smtpConfigured = false
|
||||
return errorMissingSmtpAddress
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ func TestSmtpConfigureEmptyHost(t *testing.T) {
|
||||
}
|
||||
|
||||
if smtpConfigured {
|
||||
t.Errorf("SMTP configured when it should not be due to empty SMTP_HOST")
|
||||
t.Errorf("SMTP configured when it should not be due to empty COMMENTO_SMTP_HOST")
|
||||
return
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ func TestSmtpConfigureEmptyAddress(t *testing.T) {
|
||||
os.Setenv("SMTP_PORT", "25")
|
||||
|
||||
if err := smtpConfigure(); err == nil {
|
||||
t.Errorf("expected error not found; SMTP should not be configured when SMTP_FROM_ADDRESS is empty")
|
||||
t.Errorf("expected error not found; SMTP should not be configured when COMMENTO_SMTP_FROM_ADDRESS is empty")
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user