@@ -7,12 +7,13 @@ const internalAuditLog = require('./audit-log');
7
7
const tempWrite = require ( 'temp-write' ) ;
8
8
const utils = require ( '../lib/utils' ) ;
9
9
const moment = require ( 'moment' ) ;
10
- const debug_mode = process . env . NODE_ENV !== 'production' || ! ! process . env . DEBUG ;
10
+ const debug_mode = process . env . NODE_ENV !== 'production' || ! ! process . env . DEBUG ;
11
+ const le_staging = process . env . NODE_ENV !== 'production' ;
11
12
const internalNginx = require ( './nginx' ) ;
12
13
const internalHost = require ( './host' ) ;
13
14
const certbot_command = '/usr/bin/certbot' ;
14
15
15
- function omissions ( ) {
16
+ function omissions ( ) {
16
17
return [ 'is_deleted' ] ;
17
18
}
18
19
@@ -36,7 +37,7 @@ const internalCertificate = {
36
37
internalCertificate . interval_processing = true ;
37
38
logger . info ( 'Renewing SSL certs close to expiry...' ) ;
38
39
39
- return utils . exec ( certbot_command + ' renew -q ' + ( debug_mode ? '--staging' : '' ) )
40
+ return utils . exec ( certbot_command + ' renew -q ' + ( le_staging ? '--staging' : '' ) )
40
41
. then ( result => {
41
42
logger . info ( result ) ;
42
43
@@ -719,7 +720,7 @@ const internalCertificate = {
719
720
'--email "' + certificate . meta . letsencrypt_email + '" ' +
720
721
'--preferred-challenges "dns,http" ' +
721
722
'-n -a webroot -d "' + certificate . domain_names . join ( ',' ) + '" ' +
722
- ( debug_mode ? '--staging' : '' ) ;
723
+ ( le_staging ? '--staging' : '' ) ;
723
724
724
725
if ( debug_mode ) {
725
726
logger . info ( 'Command:' , cmd ) ;
@@ -769,7 +770,7 @@ const internalCertificate = {
769
770
renewLetsEncryptSsl : certificate => {
770
771
logger . info ( 'Renewing Let\'sEncrypt certificates for Cert #' + certificate . id + ': ' + certificate . domain_names . join ( ', ' ) ) ;
771
772
772
- let cmd = certbot_command + ' renew -n --force-renewal --disable-hook-validation --cert-name "npm-' + certificate . id + '" ' + ( debug_mode ? '--staging' : '' ) ;
773
+ let cmd = certbot_command + ' renew -n --force-renewal --disable-hook-validation --cert-name "npm-' + certificate . id + '" ' + ( le_staging ? '--staging' : '' ) ;
773
774
774
775
if ( debug_mode ) {
775
776
logger . info ( 'Command:' , cmd ) ;
@@ -790,8 +791,8 @@ const internalCertificate = {
790
791
revokeLetsEncryptSsl : ( certificate , throw_errors ) => {
791
792
logger . info ( 'Revoking Let\'sEncrypt certificates for Cert #' + certificate . id + ': ' + certificate . domain_names . join ( ', ' ) ) ;
792
793
793
- let revoke_cmd = certbot_command + ' revoke --cert-path "/etc/letsencrypt/live/npm-' + certificate . id + '/fullchain.pem" ' + ( debug_mode ? '--staging' : '' ) ;
794
- let delete_cmd = certbot_command + ' delete --cert-name "npm-' + certificate . id + '" ' + ( debug_mode ? '--staging' : '' ) ;
794
+ let revoke_cmd = certbot_command + ' revoke --cert-path "/etc/letsencrypt/live/npm-' + certificate . id + '/fullchain.pem" ' + ( le_staging ? '--staging' : '' ) ;
795
+ let delete_cmd = certbot_command + ' delete --cert-name "npm-' + certificate . id + '" ' + ( le_staging ? '--staging' : '' ) ;
795
796
796
797
if ( debug_mode ) {
797
798
logger . info ( 'Command:' , revoke_cmd ) ;
0 commit comments