lib/mia-js.js
function () {
        Shared.initialize('/config', process.argv[2]);
        Shared.setAppHttp(appHttp);
        Shared.setAppHttps(appHttps);
        Shared.setExpress(express);

        // Init memcached
        var memcached = Shared.memcached();

        // Init redis cache
        var redis = Shared.redis(true);

        //Enable gzip compression
        appHttp.use(compression());
        appHttp.disable('x-powered-by');
        appHttps.use(compression());
        appHttps.disable('x-powered-by');

        var env = Shared.config("environment");
        var maxLag = env.maxLag;
        if (maxLag) {
            toobusy.maxLag(maxLag);
        }

        appHttp.use(function (req, res, next) {
            if (maxLag && toobusy()) {
                Logger.error("Server is busy, rejected request");
                res.status(503).send("I'm busy right now, sorry.");
            } else {
                next();
            }
        });

        appHttps.use(function (req, res, next) {
            if (maxLag && toobusy()) {
                Logger.error("Server is busy, rejected request");
                res.status(503).send("I'm busy right now, sorry.");
            } else {
                next();
            }
        });

        return Q();
    }
function () {
        Shared.initialize('/config', process.argv[2]);
        Shared.setAppHttp(appHttp);
        Shared.setAppHttps(appHttps);
        Shared.setExpress(express);

        // Init memcached
        var memcached = Shared.memcached();

        // Init redis cache
        var redis = Shared.redis(true);

        //Enable gzip compression
        appHttp.use(compression());
        appHttp.disable('x-powered-by');
        appHttps.use(compression());
        appHttps.disable('x-powered-by');

        var env = Shared.config("environment");
        var maxLag = env.maxLag;
        if (maxLag) {
            toobusy.maxLag(maxLag);
        }

        appHttp.use(function (req, res, next) {
            if (maxLag && toobusy()) {
                Logger.error("Server is busy, rejected request");
                res.status(503).send("I'm busy right now, sorry.");
            } else {
                next();
            }
        });

        appHttps.use(function (req, res, next) {
            if (maxLag && toobusy()) {
                Logger.error("Server is busy, rejected request");
                res.status(503).send("I'm busy right now, sorry.");
            } else {
                next();
            }
        });

        return Q();
    }
function ( ) { Shared . initialize ( '/config' , process . argv [ 2 ] ) ; Shared . setAppHttp ( appHttp ) ; Shared . setAppHttps ( appHttps ) ; Shared . setExpress ( express ) ; // Init memcached var memcached = Shared . memcached ( ) ; // Init redis cache var redis = Shared . redis ( true ) ; //Enable gzip compression appHttp . use ( compression ( ) ) ; appHttp . disable ( 'x-powered-by' ) ; appHttps . use ( compression ( ) ) ; appHttps . disable ( 'x-powered-by' ) ; var env = Shared . config ( "environment" ) ; var maxLag = env . maxLag ; if ( maxLag ) { toobusy . maxLag ( maxLag ) ; } appHttp . use ( function ( req , res , next ) { if ( maxLag && toobusy ( ) ) { Logger . error ( "Server is busy, rejected request" ) ; res . status ( 503 ) . send ( "I'm busy right now, sorry." ) ; } else { next ( ) ; } } ) ; appHttps . use ( function ( req , res , next ) { if ( maxLag && toobusy ( ) ) { Logger . error ( "Server is busy, rejected request" ) ; res . status ( 503 ) . send ( "I'm busy right now, sorry." ) ; } else { next ( ) ; } } ) ; return Q ( ) ; }
Set initialize functions
@returns {*}
@private
Set initialize functions