-
Notifications
You must be signed in to change notification settings - Fork 2
/
bowline.js
58 lines (40 loc) · 1.95 KB
/
bowline.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// ----------------------------------------------------------------------------------------
// ______ ______ __ __ __ __ __ __ ______
// /\ == \ /\ __ \ /\ \ _ \ \ /\ \ /\ \ /\ "-.\ \ /\ ___\
// \ \ __< \ \ \/\ \ \ \ \/ ".\ \ \ \ \____ \ \ \ \ \ \-. \ \ \ __\
// \ \_____\ \ \_____\ \ \__/".~\_\ \ \_____\ \ \_\ \ \_\\"\_\ \ \_____\
// \/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_____/
//
// ----------------------------------------------------------------------------------------
// An autobuilder for building a project into a docker image, and pushing it to dockerhub.
// "It ties your Docker image to a build process"
// @dougbtv 10/11/2014
// ----------------------------------------------------------------------------------------
// Parse our options with nomnom. We centralize this here.
var Options = require("./library/Options.js");
var options = new Options();
var mongoose = require('mongoose');
options.parse(function(err,opts){
// console.log("!trace opts: ",opts);
// -- Connect to mongo.
if (err) {
throw "Configuration LOAD ERROR: " + err;
}
// we start logging quite early.
var Log = require('./library/Log.js');
var log = new Log(opts);
mongoose.connect(opts.MONGO_CONNECT_STRING);
var db = mongoose.connection;
db.on('error', function(){
console.log("MONGO CONNECTION ERROR: ",{server: opts.MONGO_CONNECT_STRING });
});
db.once('open', function callback () {
log.it("configuration_loaded",{ configname: opts.CONFIG_NAME });
// We're connected to mongo, now.
log.it("mongo_connect",{server: opts.MONGO_CONNECT_STRING });
// Bowline handles our matters.
var Bowline = require("./library/Bowline.js");
var bowline = new Bowline(opts,log,mongoose);
});
});
// Just a stub. Tie together more modules here in the future if need be.