forked from kuzzleio/kuzzle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* KZL-143 KZL-145 add admin controller and reset cache action * Boyscout: fix crash because kuzzle try to load protocols in simplefiles * Add tests for adminController * Add resetKuzzleData and resetSecurity * fix features for admin controller * Add resetDatabase * fix tests * fix tests * fix tests * Add default rights restrictions for admin controller * Fix test * Fix test * Use API for all actions except dump * Add generateDump * Fix tests and remove old cli tests * Remove reset security scenario * Make sonarqube happy * Remove references to cliController * Fix features * fix internal error * remove internal broker * re-add shutdown * fix test * Put shutdown in adminController * Reset defaults roles and profiles with resetSecurity * replace ws by uws * Nitpicking * increase coverage * increase coverage * increase coverage * fix linter * increase coverage * put back proxyBroker * fix tests * remove tests * fix tests * nitpicking * Updates for PR * Put back defaut config * Disable dump if it is specified in config * fix message in cli * add truncate() method on repositories + refactor admin controller to use truncate() * fix admin controller * fix test * Add Janitor core component * return number of deleted objects in truncate * fix linter * catch TypeError for scanStream * fix linter * Please sonarqube * fix linter * Nitpicking * Updates for PR * update headers * fix linter * fix tests
- Loading branch information
Showing
151 changed files
with
3,085 additions
and
3,088 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Kuzzle, a backend software, self-hostable and ready to use | ||
* to power modern apps | ||
* | ||
* Copyright 2015-2018 Kuzzle | ||
* mailto: support AT kuzzle.io | ||
* website: http://kuzzle.io | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* eslint-disable no-console */ | ||
|
||
const | ||
rc = require('rc'), | ||
params = rc('kuzzle'), | ||
readlineSync = require('readline-sync'), | ||
ColorOutput = require('./colorOutput'), | ||
sendAction = require('./sendAction'); | ||
|
||
function commandResetDatabase (options) { | ||
const | ||
cout = new ColorOutput(options); | ||
|
||
let userIsSure = false; | ||
|
||
console.log(cout.warn('[ℹ] You are about to clear all data stored on Kuzzle.')); | ||
console.log(cout.warn('[ℹ] This operation cannot be undone.\n')); | ||
|
||
if (!params.noint) { | ||
userIsSure = readlineSync.question('[❓] Are you sure? If so, please type "I am sure": ') === 'I am sure'; | ||
} | ||
else { | ||
// non-interactive mode | ||
userIsSure = true; | ||
} | ||
|
||
if (userIsSure) { | ||
console.log(cout.notice('[ℹ] Processing...\n')); | ||
const args = { | ||
controller: 'admin', | ||
action: 'resetDatabase' | ||
}; | ||
|
||
return sendAction(options, args) | ||
.then(() => { | ||
console.log(cout.ok('[✔] Kuzzle databases have been successfully reset')); | ||
process.exit(0); | ||
}) | ||
.catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
} | ||
|
||
console.log(cout.notice('[ℹ] Aborted')); | ||
} | ||
|
||
module.exports = commandResetDatabase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.