Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var config = require('ghost/core/server/config');
var deasync = require('deasync');
var fs = require('fs');
var knexMigrator = require('knex-migrator');
var logging = require('ghost-ignition').logging();
var path = require('path');
var replaceInFile = require('replace-in-file');
var strReplaceAll = require('str-replace-all');
var uglifyJs = require('uglify-es');
var zlib = require('zlib');
// to hold the generated server cache
var serverCacheItems = [];
var serverCacheFilesProcessed = [];
// files being processed
var configProductionJsonPath = path.resolve(__dirname, 'config.production.json');
var knexMigratorPath = path.resolve(__dirname, 'node_modules/ghost');
var serverJsPath = path.resolve(__dirname, 'server.js');
var serverCacheJsPath = path.resolve(__dirname, 'server.cache.js');
var serverCacheJsZippedPath = path.resolve(__dirname, 'server.cache.js.gz');
// let users know which database is being initialised
var logging = require('ghost-ignition').logging();
var config = require('ghost/core/server/config');
logging.info('Initialising ' + config.get('env'));
// if we're running in Azure and not configuring production, warn the user
if ((process.env.REGION_NAME) && (process.env.WEBSITE_SKU) && (!process.env.EMULATED) && (config.get('env') !== 'production')) {
logging.warn('Appear to be running in Azure but not configuring production database');
};
// re-initialise database by resetting it and then initialising it
var KnexMigrator = require('knex-migrator');
knexMigrator = new KnexMigrator({
knexMigratorFilePath: __dirname + '\\node_modules\\ghost'
});
logging.info('Resetting ' + config.get('env'));
knexMigrator.reset()
var config = require('ghost-ignition').config();
// see defaults in GhostLogger
var logging = require('ghost-ignition').logging({
path: config.get('logging:path'),
domain: config.get('logging:domain'),
mode: config.get('logging:mode'),
level: config.get('logging:level'),
transports: config.get('logging:transports')
});
module.exports = logging;
// let users know which database is being initialised
var logging = require('ghost-ignition').logging();
var config = require('ghost/core/server/config');
logging.info('Migrating ' + config.get('env'));
// if we're running in Azure and not configuring production, warn the user
if ((process.env.REGION_NAME) && (process.env.WEBSITE_SKU) && (!process.env.EMULATED) && (config.get('env') !== 'production')) {
logging.warn('Appear to be running in Azure but not configuring production database');
};
// migrate database to latest version
var KnexMigrator = require('knex-migrator');
knexMigrator = new KnexMigrator({
knexMigratorFilePath: __dirname + '\\node_modules\\ghost'
});
knexMigrator.migrate()
.then(function onMigrateSuccess() {
const config = require('../../config'),
{logging} = require('ghost-ignition');
module.exports = logging({
name: config.get('logging:name'),
env: config.get('env'),
path: config.get('logging:path') || config.getContentPath('logs'),
domain: config.get('url'),
mode: config.get('logging:mode'),
level: config.get('logging:level'),
transports: config.get('logging:transports'),
gelf: config.get('logging:gelf'),
loggly: config.get('logging:loggly'),
rotation: config.get('logging:rotation')
});
var config = require('../../config'),
logging = require('ghost-ignition').logging;
module.exports = logging({
env: config.get('env'),
path: config.get('logging:path') || config.getContentPath('logs'),
domain: config.get('url'),
mode: config.get('logging:mode'),
level: config.get('logging:level'),
transports: config.get('logging:transports'),
loggly: config.get('logging:loggly'),
rotation: config.get('logging:rotation')
});