aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/danger/clean/cleaner.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-10-13 21:45:23 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-10-13 21:45:23 +0200
commit82221ac920ad2e6bafc742a09fa1636899d4173e (patch)
tree4c7928dd457d9e3b223bd2835ae0d23cd3c87d41 /scripts/danger/clean/cleaner.js
parent0b10407e465d639cd141fe8821a8504a0b7b83fb (diff)
downloadPeerTube-82221ac920ad2e6bafc742a09fa1636899d4173e.tar.gz
PeerTube-82221ac920ad2e6bafc742a09fa1636899d4173e.tar.zst
PeerTube-82221ac920ad2e6bafc742a09fa1636899d4173e.zip
Update clean script
Diffstat (limited to 'scripts/danger/clean/cleaner.js')
-rw-r--r--scripts/danger/clean/cleaner.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/danger/clean/cleaner.js b/scripts/danger/clean/cleaner.js
new file mode 100644
index 000000000..a63c478e0
--- /dev/null
+++ b/scripts/danger/clean/cleaner.js
@@ -0,0 +1,23 @@
1const rimraf = require('rimraf')
2const mongoose = require('mongoose')
3
4const constants = require('../../../server/initializers/constants')
5
6const mongodbUrl = 'mongodb://' + constants.CONFIG.DATABASE.HOST + ':' + constants.CONFIG.DATABASE.PORT + '/' + constants.CONFIG.DATABASE.DBNAME
7mongoose.connect(mongodbUrl, function () {
8 console.info('Deleting MongoDB %s database.', constants.CONFIG.DATABASE.DBNAME)
9 mongoose.connection.db.dropDatabase(function () {
10 mongoose.connection.close()
11 })
12})
13
14const STORAGE = constants.CONFIG.STORAGE
15Object.keys(STORAGE).forEach(function (storage) {
16 const storageDir = STORAGE[storage]
17
18 rimraf(storageDir, function (err) {
19 if (err) throw err
20
21 console.info('Deleting %s.', storageDir)
22 })
23})