webgme/webgme-cli

View on GitHub
src/res/config.template.js.ejs

Summary

Maintainability
Test Coverage
// DO NOT EDIT THIS FILE
// This file is automatically generated from the webgme-setup-tool.
'use strict';

<% if (typeof seeds === "undefined") seeds = [];
if (typeof addons === "undefined") addons = [];
if (typeof plugins === "undefined") plugins = [];
if (typeof decorators === "undefined") decorators = [];
if (typeof visualizers === "undefined") visualizers = [];
if (typeof layouts === "undefined") layouts = [];
if (typeof requirejsPaths === "undefined") requirejsPaths = null;

var dirname = function(path) {
  var pathItems = path.split('/');
  pathItems.pop();
  return pathItems.join('/');
};

var printBasePaths = function(name, paths) {
    return printConfigPaths(name+'.basePaths', paths);
};

var printConfigPaths = function(name, paths) {
  paths = _.uniq(paths);
  var text =  paths.map(function(path) {
    return 'config.'+name+'.push(__dirname + \'/../'+path+'\');'
  }).join('\n');
  return text.length ? text+'\n' : text;
}; %>
var config = require('webgme/config/config.default'),
    validateConfig = require('webgme/config/validator');

// The paths can be loaded from the webgme-setup.json
<%= printBasePaths('plugin', plugins.map(dirname)) +
    printBasePaths('addOn', addons.map(dirname)) +
    printBasePaths('visualization.layout', layouts.map(dirname)) +
    printConfigPaths('visualization.decoratorPaths', decorators.map(dirname)) +
    printBasePaths('seedProjects', seeds) %>
<% if (addons.length > 0) { %>config.addOn.enable = true;<%}%>

<%= printConfigPaths('visualization.panelPaths', visualizers.map(dirname)) %>

<%= routers.map(function(router) {
    return [
        'config.rest.components[\'' + router.name + '\'] = {',
        '  src: __dirname + \'/../' + router.srcFile + '\',',
        '  mount: \'' + router.mount + '\',',
        '  options: {}',
        '};'
    ].join('\n');
}).join('\n') %>

// Visualizer descriptors
<% if (visualizers.length > 0) { %>config.visualization.visualizerDescriptors.push(__dirname + '/../src/visualizers/Visualizers.json');<%}%>
// Add requirejs paths
<% if (requirejsPaths) { %>config.requirejsPaths = {
<%= requirejsPaths.map(function(obj) { 
        return '  \''+obj.name+'\': \''+obj.path+'\'';
    }).join(',\n') %>
};<% } %>

<% if (typeof defaultLayout !== 'undefined') {%>config.visualization.layout.default = '<%= defaultLayout %>';<% } %>
<% // mongo uri %>config.mongo.uri = 'mongodb://127.0.0.1:27017/<%= appName.replace(/\./g, '_') %>';
validateConfig(config);
module.exports = config;