'use strict';

// global requires
global.logger = require('../utils/Logger').loggers.get('main');
global.utilBanner = require('../utils/UtilBanner');

// print the banner to show the app is starting. This should be as early in the startup as possible, after the logging is set up'
var pjson = require('../../package.json');
utilBanner.printStartingBanner(pjson);

global.config = require('../configLoader/Config');
global.SharedConstants = require('../../shared/constants/SharedConstants');

config.load()
    .then(function successFunc() {
            logger.info("Configuration loaded, starting elastic sync processor.");
            var server = require('./ElasticSyncProcessor');
            server.start();
        },
        function errorFunc(err) {
            logger.error("Fatal error loading configuration - " + err);
            process.exit(1);
        }
    );