<commit_before>'use strict';

if (!process.env.BASE_DIR) {
    process.env.BASE_DIR = __dirname;
}
require('dumonda-me-server-lib').init('dumondaMe');
global.requireDb = function () {
    return require('dumonda-me-server-lib').neo4j;
};
global.requireModel = function (name) {
    return require(`${__dirname}/api/models/${name}`);
};

require('dumonda-me-server-lib').jsonValidation;
const Promise = require('bluebird');

Promise.Promise.config({warnings: false, longStackTraces: true, cancellation: true});
const isServerDevelopment = process.env.NODE_ENV === 'development';
const isProduction = process.env.NODE_ENV === 'production';
const isTesting = process.env.NODE_ENV === 'testing';

const {Nuxt, Builder} = require('nuxt');
let nuxt = null;
if (!isTesting) {
    const nuxtConfig = require('./nuxt.config.js');
    nuxt = new Nuxt(nuxtConfig);
}

const kraken = require('kraken-js');
const dbConfig = require('dumonda-me-server-lib').databaseConfig;
const app = require('express')();
const options = require('dumonda-me-server-lib').spec(app, nuxt);
const logger = require('dumonda-me-server-lib').logging.getLogger(__filename);
const port = process.env.PORT || 3001;

if (isProduction || isServerDevelopment) {
    app.enable('trust proxy');
    logger.info('Enabled trust proxy');
}

app.use(kraken(options));

app.on('start', function () {
    dbConfig.connected.then(function () {
        logger.info('Admin Server started');
    });
});

app.on('exit', function () {
    requireDb().closeDriver();
});

if (isProduction || isServerDevelopment || isTesting) {
    listen();
} else {
    new Builder(nuxt).build()
        .then(listen)<commit_msg>Add log if server started.<commit_after>'use strict';

if (!process.env.BASE_DIR) {
    process.env.BASE_DIR = __dirname;
}
require('dumonda-me-server-lib').init('dumondaMe');
global.requireDb = function () {
    return require('dumonda-me-server-lib').neo4j;
};
global.requireModel = function (name) {
    return require(`${__dirname}/api/models/${name}`);
};

require('dumonda-me-server-lib').jsonValidation;
const Promise = require('bluebird');

Promise.Promise.config({warnings: false, longStackTraces: true, cancellation: true});
const isServerDevelopment = process.env.NODE_ENV === 'development';
const isProduction = process.env.NODE_ENV === 'production';
const isTesting = process.env.NODE_ENV === 'testing';

const {Nuxt, Builder} = require('nuxt');
let nuxt = null;
if (!isTesting) {
    const nuxtConfig = require('./nuxt.config.js');
    nuxt = new Nuxt(nuxtConfig);
}

const kraken = require('kraken-js');
const dbConfig = require('dumonda-me-server-lib').databaseConfig;
const app = require('express')();
const options = require('dumonda-me-server-lib').spec(app, nuxt);
const logger = require('dumonda-me-server-lib').logging.getLogger(__filename);
const port = process.env.PORT || 3001;

if (isProduction || isServerDevelopment) {
    app.enable('trust proxy');
    logger.info('Enabled trust proxy');
}

app.use(kraken(options));

app.on('start', function () {
    logger.info('Wait until database connection is established');
    dbConfig.connected.then(function () {
        logger.info('Admin Server started');
    });
});

app.on('exit', function () {
    requireDb().closeDriver();
});

if (isProduction || isServerDevelopment || isTesting) {
    listen();
} else {
    new Builder(nuxt).build()
        .then(listen)
{'fraction_non_alphanumeric': 0.17563989408649602, 'fraction_numerical': 0.0029420417769932335, 'mean_word_length': 4.892547660311958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6780655', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1068, 'n_words': 209}