mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 13:16:29 +08:00
a7e9c0c776
- Updated enum values to be uppercase - Updated services to expose service models - Updated models to only export the mongoose model - Moved all mongoose static methods over to new services - Updated tests to refelct new setup BREAKING - Status that were uppercased (caps) have caused issues with the admin pages
46 lines
1.1 KiB
JavaScript
Executable File
46 lines
1.1 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Module dependencies.
|
|
*/
|
|
|
|
const program = require('commander');
|
|
const mongoose = require('../services/mongoose');
|
|
const SettingsService = require('../services/settings');
|
|
const util = require('../util');
|
|
|
|
// Register the shutdown criteria.
|
|
util.onshutdown([
|
|
() => mongoose.disconnect()
|
|
]);
|
|
|
|
//==============================================================================
|
|
// Setting up the program command line arguments.
|
|
//==============================================================================
|
|
|
|
program
|
|
.command('init')
|
|
.description('initilizes the talk settings')
|
|
.action(() => {
|
|
const defaults = {id: '1', moderation: 'pre'};
|
|
|
|
SettingsService
|
|
.init(defaults)
|
|
.then(() => {
|
|
console.log('Created settings object.');
|
|
util.shutdown();
|
|
})
|
|
.catch((err) => {
|
|
console.error(`failed to create the settings object ${JSON.stringify(err)}`);
|
|
util.shutdown(1);
|
|
});
|
|
});
|
|
|
|
program.parse(process.argv);
|
|
|
|
// If there is no command listed, output help.
|
|
if (!process.argv.slice(2).length) {
|
|
program.outputHelp();
|
|
util.shutdown();
|
|
}
|