Code Issues 1,462 Pull requests 235 Pulse

server/config/regenerate-client.js

#!/usr/bin/env node
/***** WARNING: ES5 code only here. Not transpiled! *****/

/**

  • Module dependencies/

*/
var fs = require( ‘fs’ ),
path = require( ‘path’ ),
configPath = path.resolve( __dirname, ‘..’, ‘..’, ‘config’ ),
keysPath = path.resolve( configPath, ‘client.json’ ),
keys = JSON.parse( fs.readFileSync( keysPath, ‘utf8’ ) ),
config = require( ‘./’ ),
data = require( ‘./parser’ )( configPath, {
env: process.env.CALYPSO_ENV || ‘development’,
includeSecrets: false,
enabledFeatures: process.env.ENABLE_FEATURES,
disabledFeatures: process.env.DISABLE_FEATURES
} ),
obj = {};

keys.forEach( function( key ) {
if ( key in data ) {
obj[ key ] = data[ key ];
}
} );

console.log( ‘/* This file is automatically generated. Do not edit manually. */’ );
console.log();
console.log( ‘var data = %s;’, JSON.stringify( obj, null, 2 ) );
console.log( config.toString() );
console.log( config.isEnabled.toString() );
console.log( config.anyEnabled.toString() );
console.log( ‘module.exports = config;’ );
console.log( ‘module.exports.isEnabled = isEnabled;’ );
console.log( ‘module.exports.anyEnabled = anyEnabled;’ );
Desktop version

Advertisements