]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - scripts/danger/clean/cleaner.js
1 const rimraf
= require('rimraf')
2 const mongoose
= require('mongoose')
3 mongoose
.Promise
= global
.Promise
5 const constants
= require('../../../server/initializers/constants')
7 const mongodbUrl
= 'mongodb://' + constants
.CONFIG
.DATABASE
.HOST
+ ':' + constants
.CONFIG
.DATABASE
.PORT
+ '/' + constants
.CONFIG
.DATABASE
.DBNAME
8 mongoose
.connect(mongodbUrl
, function () {
9 console
.info('Deleting MongoDB %s database.', constants
.CONFIG
.DATABASE
.DBNAME
)
10 mongoose
.connection
.dropDatabase(function () {
11 mongoose
.connection
.close()
15 const STORAGE
= constants
.CONFIG
.STORAGE
16 Object
.keys(STORAGE
).forEach(function (storage
) {
17 const storageDir
= STORAGE
[storage
]
19 rimraf(storageDir
, function (err
) {
22 console
.info('Deleting %s.', storageDir
)