@@ -169,20 +169,24 @@ func loadServerFrom(rootCfg ConfigProvider) {
169169 HTTPAddr = sec .Key ("HTTP_ADDR" ).MustString ("0.0.0.0" )
170170 HTTPPort = sec .Key ("HTTP_PORT" ).MustString ("3000" )
171171
172+ // DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
173+ // if these are removed, the warning will not be shown
174+ if sec .HasKey ("ENABLE_ACME" ) {
175+ EnableAcme = sec .Key ("ENABLE_ACME" ).MustBool (false )
176+ } else {
177+ deprecatedSetting (rootCfg , "server" , "ENABLE_LETSENCRYPT" , "server" , "ENABLE_ACME" , "v1.19.0" )
178+ EnableAcme = sec .Key ("ENABLE_LETSENCRYPT" ).MustBool (false )
179+ }
180+
172181 Protocol = HTTP
173182 protocolCfg := sec .Key ("PROTOCOL" ).String ()
183+ if protocolCfg != "https" && EnableAcme {
184+ log .Fatal ("ACME could only be used with HTTPS protocol" )
185+ }
186+
174187 switch protocolCfg {
175188 case "https" :
176189 Protocol = HTTPS
177-
178- // DEPRECATED should not be removed because users maybe upgrade from lower version to the latest version
179- // if these are removed, the warning will not be shown
180- if sec .HasKey ("ENABLE_ACME" ) {
181- EnableAcme = sec .Key ("ENABLE_ACME" ).MustBool (false )
182- } else {
183- deprecatedSetting (rootCfg , "server" , "ENABLE_LETSENCRYPT" , "server" , "ENABLE_ACME" , "v1.19.0" )
184- EnableAcme = sec .Key ("ENABLE_LETSENCRYPT" ).MustBool (false )
185- }
186190 if EnableAcme {
187191 AcmeURL = sec .Key ("ACME_URL" ).MustString ("" )
188192 AcmeCARoot = sec .Key ("ACME_CA_ROOT" ).MustString ("" )
@@ -210,6 +214,9 @@ func loadServerFrom(rootCfg ConfigProvider) {
210214 deprecatedSetting (rootCfg , "server" , "LETSENCRYPT_EMAIL" , "server" , "ACME_EMAIL" , "v1.19.0" )
211215 AcmeEmail = sec .Key ("LETSENCRYPT_EMAIL" ).MustString ("" )
212216 }
217+ if AcmeEmail == "" {
218+ log .Fatal ("ACME Email is not set (ACME_EMAIL)." )
219+ }
213220 } else {
214221 CertFile = sec .Key ("CERT_FILE" ).String ()
215222 KeyFile = sec .Key ("KEY_FILE" ).String ()
0 commit comments