@@ -109,12 +109,12 @@ var (
109
109
UnixSocketPermission uint32
110
110
EnablePprof bool
111
111
PprofDataPath string
112
- EnableLetsEncrypt bool
112
+ EnableAcme bool
113
113
LetsEncryptTOS bool
114
- LetsEncryptDirectory string
115
- LetsEncryptEmail string
116
- ACMECAURL string
117
- ACMECARoot string
114
+ AcmeLiveDirectory string
115
+ AcmeEmail string
116
+ AcmeURL string
117
+ AcmeCARoot string
118
118
SSLMinimumVersion string
119
119
SSLMaximumVersion string
120
120
SSLCurvePreferences []string
@@ -624,14 +624,49 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
624
624
switch protocolCfg {
625
625
case "https" :
626
626
Protocol = HTTPS
627
- CertFile = sec .Key ("CERT_FILE" ).String ()
628
- KeyFile = sec .Key ("KEY_FILE" ).String ()
629
- if ! filepath .IsAbs (CertFile ) && len (CertFile ) > 0 {
630
- CertFile = filepath .Join (CustomPath , CertFile )
627
+ // FIXME: DEPRECATED to be removed in v1.18.0
628
+ if sec .HasKey ("ENABLE_ACME" ) {
629
+ EnableAcme = sec .Key ("ENABLE_ACME" ).MustBool (false )
630
+ } else {
631
+ deprecatedSetting ("server" , "ENABLE_LETSENCRYPT" , "server" , "ENABLE_ACME" )
632
+ EnableAcme = sec .Key ("ENABLE_LETSENCRYPT" ).MustBool (false )
631
633
}
632
- if ! filepath .IsAbs (KeyFile ) && len (KeyFile ) > 0 {
633
- KeyFile = filepath .Join (CustomPath , KeyFile )
634
+ if EnableAcme {
635
+ AcmeURL = sec .Key ("ACME_URL" ).MustString ("" )
636
+ AcmeCARoot = sec .Key ("ACME_CA_ROOT" ).MustString ("" )
637
+ LetsEncryptTOS = sec .Key ("LETSENCRYPT_ACCEPTTOS" ).MustBool (false )
638
+ // The TOS is only required when using LetsEncrypt
639
+ if AcmeURL == "" && ! LetsEncryptTOS {
640
+ log .Fatal ("Let's Encrypt TOS (LETSENCRYPT_ACCEPTTOS) is not accepted. Either accept it or configure a different ACME provider (ACME_URL)" )
641
+ }
642
+ // FIXME: DEPRECATED to be removed in v1.18.0
643
+ if sec .HasKey ("ACME_DIRECTORY" ) {
644
+ AcmeLiveDirectory = sec .Key ("ACME_DIRECTORY" ).MustString ("https" )
645
+ } else {
646
+ deprecatedSetting ("server" , "LETSENCRYPT_DIRECTORY" , "server" , "ACME_DIRECTORY" )
647
+ AcmeLiveDirectory = sec .Key ("LETSENCRYPT_DIRECTORY" ).MustString ("https" )
648
+ }
649
+ // FIXME: DEPRECATED to be removed in v1.18.0
650
+ if sec .HasKey ("ACME_EMAIL" ) {
651
+ AcmeEmail = sec .Key ("ACME_EMAIL" ).MustString ("" )
652
+ } else {
653
+ deprecatedSetting ("server" , "LETSENCRYPT_EMAIL" , "server" , "ACME_EMAIL" )
654
+ AcmeEmail = sec .Key ("LETSENCRYPT_EMAIL" ).MustString ("" )
655
+ }
656
+ } else {
657
+ CertFile = sec .Key ("CERT_FILE" ).String ()
658
+ KeyFile = sec .Key ("KEY_FILE" ).String ()
659
+ if ! filepath .IsAbs (CertFile ) && len (CertFile ) > 0 {
660
+ CertFile = filepath .Join (CustomPath , CertFile )
661
+ }
662
+ if ! filepath .IsAbs (KeyFile ) && len (KeyFile ) > 0 {
663
+ KeyFile = filepath .Join (CustomPath , KeyFile )
664
+ }
634
665
}
666
+ SSLMinimumVersion = sec .Key ("SSL_MIN_VERSION" ).MustString ("" )
667
+ SSLMaximumVersion = sec .Key ("SSL_MAX_VERSION" ).MustString ("" )
668
+ SSLCurvePreferences = sec .Key ("SSL_CURVE_PREFERENCES" ).Strings ("," )
669
+ SSLCipherSuites = sec .Key ("SSL_CIPHER_SUITES" ).Strings ("," )
635
670
case "fcgi" :
636
671
Protocol = FCGI
637
672
case "fcgi+unix" , "unix" , "http+unix" :
@@ -655,20 +690,6 @@ func loadFromConf(allowEmpty bool, extraConfig string) {
655
690
HTTPAddr = filepath .Join (AppWorkPath , HTTPAddr )
656
691
}
657
692
}
658
- EnableLetsEncrypt = sec .Key ("ENABLE_LETSENCRYPT" ).MustBool (false )
659
- ACMECAURL = sec .Key ("ACME_CAURL" ).MustString ("" )
660
- ACMECARoot = sec .Key ("ACME_CARoot" ).MustString ("" )
661
- LetsEncryptTOS = sec .Key ("LETSENCRYPT_ACCEPTTOS" ).MustBool (false )
662
- if ! LetsEncryptTOS && EnableLetsEncrypt {
663
- log .Warn ("Failed to enable Let's Encrypt due to Let's Encrypt TOS not being accepted" )
664
- EnableLetsEncrypt = false
665
- }
666
- LetsEncryptDirectory = sec .Key ("LETSENCRYPT_DIRECTORY" ).MustString ("https" )
667
- LetsEncryptEmail = sec .Key ("LETSENCRYPT_EMAIL" ).MustString ("" )
668
- SSLMinimumVersion = sec .Key ("SSL_MIN_VERSION" ).MustString ("" )
669
- SSLMaximumVersion = sec .Key ("SSL_MAX_VERSION" ).MustString ("" )
670
- SSLCurvePreferences = sec .Key ("SSL_CURVE_PREFERENCES" ).Strings ("," )
671
- SSLCipherSuites = sec .Key ("SSL_CIPHER_SUITES" ).Strings ("," )
672
693
GracefulRestartable = sec .Key ("ALLOW_GRACEFUL_RESTARTS" ).MustBool (true )
673
694
GracefulHammerTime = sec .Key ("GRACEFUL_HAMMER_TIME" ).MustDuration (60 * time .Second )
674
695
StartupTimeout = sec .Key ("STARTUP_TIMEOUT" ).MustDuration (0 * time .Second )
0 commit comments