20221219011829-remove-basic-auth-related-config.js 767 B

12345678910111213141516171819202122232425
  1. // eslint-disable-next-line import/no-named-as-default
  2. import { Config } from '~/server/models/config';
  3. import { getMongoUri, mongoOptions } from '~/server/util/mongoose-utils';
  4. import loggerFactory from '~/utils/logger';
  5. const logger = loggerFactory('growi:migrate:remove-basic-auth-related-config');
  6. const mongoose = require('mongoose');
  7. module.exports = {
  8. async up() {
  9. logger.info('Apply migration');
  10. await mongoose.connect(getMongoUri(), mongoOptions);
  11. await Config.findOneAndDelete({ key: 'security:passport-basic:isEnabled' });
  12. await Config.findOneAndDelete({ key: 'security:passport-basic:isSameUsernameTreatedAsIdenticalUser' });
  13. logger.info('Migration has successfully applied');
  14. },
  15. async down() {
  16. // No rollback
  17. },
  18. };