From 75b7d78eacffb1715a61700858760d7d0bc507d2 Mon Sep 17 00:00:00 2001 From: Vivek Patel Date: Thu, 4 Aug 2022 18:06:29 +0530 Subject: [PATCH] Fix SMTP values in settings on server restart It addresses issue with SMTP_* setting value, which were overwritten by values from env on server restart and also, removed default value of SMTP_HOST and SMTP_PORT, which were also causing the same issue. --- .env.example | 4 ++-- app/boot_levels.go | 4 +++- app/options/SMTP.cue | 2 -- pkg/options/options.gen.go | 5 +---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index a361303c3..e399482d6 100644 --- a/.env.example +++ b/.env.example @@ -300,8 +300,8 @@ ############################################################################### # The SMTP server hostname. # Type: string -# Default: localhost -# SMTP_HOST=localhost +# Default: +# SMTP_HOST= ############################################################################### # The SMTP post. diff --git a/app/boot_levels.go b/app/boot_levels.go index 74609cfc9..43a780df3 100644 --- a/app/boot_levels.go +++ b/app/boot_levels.go @@ -806,11 +806,13 @@ func applySmtpOptionsToSettings(ctx context.Context, log *zap.Logger, opt option log.Warn( "Environmental variables (SMTP_*) and SMTP settings " + "(most likely changed via admin console) are not the same. " + - "When server was restarted, values from environmental" + + "When server was restarted, values from environmental " + "variables were copied to settings for easier management. " + "To avoid confusion and potential issues, we suggest you to " + "remove all SMTP_* variables") } + + return } // SMTP server settings do not exist but diff --git a/app/options/SMTP.cue b/app/options/SMTP.cue index c464dcd48..bfb5adabd 100644 --- a/app/options/SMTP.cue +++ b/app/options/SMTP.cue @@ -21,12 +21,10 @@ SMTP: schema.#optionsGroup & { options: { host: { - defaultValue: "localhost" description: "The SMTP server hostname." } port: { type: "int" - defaultGoExpr: "25" description: "The SMTP post." } user: { diff --git a/pkg/options/options.gen.go b/pkg/options/options.gen.go index 2a8353f88..87b741a1e 100644 --- a/pkg/options/options.gen.go +++ b/pkg/options/options.gen.go @@ -430,10 +430,7 @@ func SCIM() (o *SCIMOpt) { // // This function is auto-generated func SMTP() (o *SMTPOpt) { - o = &SMTPOpt{ - Host: "localhost", - Port: 25, - } + o = &SMTPOpt{} // Custom defaults func(o interface{}) {