aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/peertube-crypto.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/peertube-crypto.js')
-rw-r--r--server/helpers/peertube-crypto.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/server/helpers/peertube-crypto.js b/server/helpers/peertube-crypto.js
index ef6808d5c..55ae6fab3 100644
--- a/server/helpers/peertube-crypto.js
+++ b/server/helpers/peertube-crypto.js
@@ -74,7 +74,9 @@ function comparePassword (plainPassword, hashPassword, callback) {
74} 74}
75 75
76function createCertsIfNotExist (callback) { 76function createCertsIfNotExist (callback) {
77 certsExist(function (exist) { 77 certsExist(function (err, exist) {
78 if (err) return callback(err)
79
78 if (exist === true) { 80 if (exist === true) {
79 return callback(null) 81 return callback(null)
80 } 82 }
@@ -113,13 +115,17 @@ module.exports = peertubeCrypto
113 115
114function certsExist (callback) { 116function certsExist (callback) {
115 const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME) 117 const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME)
116 fs.exists(certPath, function (exists) { 118 fs.access(certPath, function (err) {
117 return callback(exists) 119 // If there is an error the certificates do not exist
120 const exists = !err
121 return callback(null, exists)
118 }) 122 })
119} 123}
120 124
121function createCerts (callback) { 125function createCerts (callback) {
122 certsExist(function (exist) { 126 certsExist(function (err, exist) {
127 if (err) return callback(err)
128
123 if (exist === true) { 129 if (exist === true) {
124 const string = 'Certs already exist.' 130 const string = 'Certs already exist.'
125 logger.warning(string) 131 logger.warning(string)