PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/mongodb/boot_auth.js

https://bitbucket.org/coleman333/smartsite
JavaScript | 52 lines | 42 code | 4 blank | 6 comment | 2 complexity | 12b4c131ddc0f37cfed7ec7c0665d1fa MD5 | raw file
 1var ReplSetManager = require('mongodb-topology-manager').ReplSet,
 2  f = require('util').format;
 3
 4var rsOptions = {
 5  server: {
 6    keyFile: __dirname + '/test/functional/data/keyfile.txt',
 7    auth: null,
 8    replSet: 'rs'
 9  },
10  client: {
11    replSet: 'rs'
12  }
13}
14
15// Set up the nodes
16var nodes = [{
17  options: {
18    bind_ip: 'localhost', port: 31000,
19    dbpath: f('%s/../db/31000', __dirname),
20  }
21}, {
22  options: {
23    bind_ip: 'localhost', port: 31001,
24    dbpath: f('%s/../db/31001', __dirname),
25  }
26}, {
27  options: {
28    bind_ip: 'localhost', port: 31002,
29    dbpath: f('%s/../db/31002', __dirname),
30  }
31}]
32
33// Merge in any node start up options
34for(var i = 0; i < nodes.length; i++) {
35  for(var name in rsOptions.server) {
36    nodes[i].options[name] = rsOptions.server[name];
37  }
38}
39
40// Create a manager
41var replicasetManager = new ReplSetManager('mongod', nodes, rsOptions.client);
42// Purge the set
43replicasetManager.purge().then(function() {
44  // Start the server
45  replicasetManager.start().then(function() {
46    process.exit(0);
47  }).catch(function(e) {
48    console.log("====== ")
49    console.dir(e)
50    // // console.dir(e);
51  });
52});