@@ -7,12 +7,13 @@ const internalAuditLog = require('./audit-log');
77const tempWrite = require ( 'temp-write' ) ;
88const utils = require ( '../lib/utils' ) ;
99const 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' ;
1112const internalNginx = require ( './nginx' ) ;
1213const internalHost = require ( './host' ) ;
1314const certbot_command = '/usr/bin/certbot' ;
1415
15- function omissions ( ) {
16+ function omissions ( ) {
1617 return [ 'is_deleted' ] ;
1718}
1819
@@ -36,7 +37,7 @@ const internalCertificate = {
3637 internalCertificate . interval_processing = true ;
3738 logger . info ( 'Renewing SSL certs close to expiry...' ) ;
3839
39- return utils . exec ( certbot_command + ' renew -q ' + ( debug_mode ? '--staging' : '' ) )
40+ return utils . exec ( certbot_command + ' renew -q ' + ( le_staging ? '--staging' : '' ) )
4041 . then ( result => {
4142 logger . info ( result ) ;
4243
@@ -719,7 +720,7 @@ const internalCertificate = {
719720 '--email "' + certificate . meta . letsencrypt_email + '" ' +
720721 '--preferred-challenges "dns,http" ' +
721722 '-n -a webroot -d "' + certificate . domain_names . join ( ',' ) + '" ' +
722- ( debug_mode ? '--staging' : '' ) ;
723+ ( le_staging ? '--staging' : '' ) ;
723724
724725 if ( debug_mode ) {
725726 logger . info ( 'Command:' , cmd ) ;
@@ -769,7 +770,7 @@ const internalCertificate = {
769770 renewLetsEncryptSsl : certificate => {
770771 logger . info ( 'Renewing Let\'sEncrypt certificates for Cert #' + certificate . id + ': ' + certificate . domain_names . join ( ', ' ) ) ;
771772
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' : '' ) ;
773774
774775 if ( debug_mode ) {
775776 logger . info ( 'Command:' , cmd ) ;
@@ -790,8 +791,8 @@ const internalCertificate = {
790791 revokeLetsEncryptSsl : ( certificate , throw_errors ) => {
791792 logger . info ( 'Revoking Let\'sEncrypt certificates for Cert #' + certificate . id + ': ' + certificate . domain_names . join ( ', ' ) ) ;
792793
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' : '' ) ;
795796
796797 if ( debug_mode ) {
797798 logger . info ( 'Command:' , revoke_cmd ) ;
0 commit comments