github.com/elliott5/community@v0.14.1-0.20160709191136-823126fb026a/app/config/environment.js (about)

     1  // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
     2  //
     3  // This software (Documize Community Edition) is licensed under
     4  // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
     5  //
     6  // You can operate outside the AGPL restrictions by purchasing
     7  // Documize Enterprise Edition and obtaining a commercial license
     8  // by contacting <sales@documize.com>.
     9  //
    10  // https://documize.com
    11  
    12  /* jshint node: true */
    13  
    14  module.exports = function (environment) {
    15  
    16  	var ENV = {
    17  		modulePrefix: 'documize',
    18  		podModulePrefix: 'documize/pods',
    19  		locationType: 'auto',
    20  		environment: environment,
    21  		baseURL: '/',
    22  		apiHost: '',
    23  		apiNamespace: '',
    24  		contentSecurityPolicyHeader: 'Content-Security-Policy-Report-Only',
    25  
    26  		EmberENV: {
    27  			FEATURES: {}
    28  		},
    29  		"ember-cli-mirage": {
    30  			enabled: false
    31  		},
    32  		'ember-simple-auth': {
    33  			authenticationRoute: 'auth.login',
    34  			routeAfterAuthentication: 'folders.folder',
    35  			routeIfAlreadyAuthenticated: 'folders.folder'
    36  		},
    37  		APP: {
    38  			// Allows to disable audit service in tests
    39  			auditEnabled: true,
    40  			intercomKey: ""
    41  		}
    42  	};
    43  
    44  	if (environment === 'development') {
    45  		ENV.APP.LOG_TRANSITIONS = true;
    46  		ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    47  		ENV['ember-cli-mirage'] = {
    48  			enabled: false
    49  		};
    50  
    51  		ENV.apiHost = "https://localhost:5001";
    52  		ENV.apiNamespace = "api";
    53  	}
    54  
    55  	if (environment === 'test') {
    56  		ENV.APP.LOG_RESOLVER = false;
    57  		ENV.APP.LOG_ACTIVE_GENERATION = false;
    58  		ENV.APP.LOG_VIEW_LOOKUPS = false;
    59  		ENV.APP.LOG_TRANSITIONS = true;
    60  		// ENV.APP.LOG_TRANSITIONS_INTERNAL = false;
    61  
    62  		ENV.baseURL = '/';
    63  		ENV.locationType = 'none';
    64  		ENV.APP.rootElement = '#ember-testing';
    65  		ENV['ember-cli-mirage'] = {
    66  			enabled: true
    67  		};
    68  		ENV.APP.auditEnabled = false;
    69  
    70  		ENV.apiHost = "https://localhost:5001";
    71  	}
    72  
    73  	if (environment === 'production') {
    74  		ENV.APP.LOG_RESOLVER = false;
    75  		ENV.APP.LOG_ACTIVE_GENERATION = false;
    76  		ENV.APP.LOG_VIEW_LOOKUPS = false;
    77  		ENV.APP.LOG_TRANSITIONS = false;
    78  		ENV.APP.LOG_TRANSITIONS_INTERNAL = false;
    79  
    80  		ENV.apiHost = "";
    81  	}
    82  
    83  	process.argv.forEach(function (element) {
    84  		if (element !== undefined) {
    85  			if (element.startsWith("intercom=")) {
    86  				element = element.replace("intercom=", "");
    87  				ENV.APP.intercomKey = element;
    88  			}
    89  			if (element.startsWith("apiHost=")) {
    90  				element = element.replace("apiHost=", "");
    91  				ENV.apiHost = element;
    92  			}
    93  		}
    94  	});
    95  
    96  	ENV.apiNamespace = "api";
    97  	ENV.contentSecurityPolicy = null;
    98  
    99  	return ENV;
   100  };