github.com/sl1pm4t/consul@v1.4.5-0.20190325224627-74c31c540f9c/ui-v2/config/environment.js (about) 1 'use strict'; 2 const fs = require('fs'); 3 const path = require('path'); 4 module.exports = function(environment) { 5 let ENV = { 6 modulePrefix: 'consul-ui', 7 environment, 8 rootURL: '/ui/', 9 locationType: 'auto', 10 EmberENV: { 11 FEATURES: { 12 // Here you can enable experimental features on an ember canary build 13 // e.g. 'with-controller': true 14 'ds-improved-ajax': true, 15 }, 16 EXTEND_PROTOTYPES: { 17 // Prevent Ember Data from overriding Date.parse. 18 Date: false, 19 }, 20 }, 21 22 APP: { 23 // Here you can pass flags/options to your application instance 24 // when it is created 25 }, 26 resizeServiceDefaults: { 27 injectionFactories: ['view', 'controller', 'component'], 28 }, 29 }; 30 ENV = Object.assign({}, ENV, { 31 CONSUL_GIT_SHA: (function() { 32 if (process.env.CONSUL_GIT_SHA) { 33 return process.env.CONSUL_GIT_SHA; 34 } 35 36 return require('child_process') 37 .execSync('git rev-parse --short HEAD') 38 .toString() 39 .trim(); 40 })(), 41 CONSUL_VERSION: (function() { 42 if (process.env.CONSUL_VERSION) { 43 return process.env.CONSUL_VERSION; 44 } 45 // see /scripts/dist.sh:8 46 const version_go = `${path.dirname(path.dirname(__dirname))}/version/version.go`; 47 const contents = fs.readFileSync(version_go).toString(); 48 return contents 49 .split('\n') 50 .find(function(item, i, arr) { 51 return item.indexOf('Version =') !== -1; 52 }) 53 .trim() 54 .split('"')[1]; 55 })(), 56 CONSUL_BINARY_TYPE: (function() { 57 if (process.env.CONSUL_BINARY_TYPE) { 58 return process.env.CONSUL_BINARY_TYPE; 59 } 60 return 'oss'; 61 })(), 62 CONSUL_DOCUMENTATION_URL: 'https://www.consul.io/docs', 63 CONSUL_COPYRIGHT_URL: 'https://www.hashicorp.com', 64 CONSUL_COPYRIGHT_YEAR: '2019', 65 }); 66 67 if (environment === 'development') { 68 // ENV.APP.LOG_RESOLVER = true; 69 // ENV.APP.LOG_ACTIVE_GENERATION = true; 70 // ENV.APP.LOG_TRANSITIONS = true; 71 // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 72 // ENV.APP.LOG_VIEW_LOOKUPS = true; 73 // ENV['ember-cli-mirage'] = { 74 // enabled: false, 75 // }; 76 } 77 78 if (environment === 'test') { 79 // Testem prefers this... 80 ENV.locationType = 'none'; 81 82 // keep test console output quieter 83 ENV.APP.LOG_ACTIVE_GENERATION = false; 84 ENV.APP.LOG_VIEW_LOOKUPS = false; 85 86 ENV.APP.rootElement = '#ember-testing'; 87 ENV.APP.autoboot = false; 88 ENV['ember-cli-api-double'] = { 89 reader: 'html', 90 endpoints: ['/node_modules/@hashicorp/consul-api-double/v1'], 91 }; 92 } 93 94 if (environment === 'production') { 95 // here you can enable a production-specific feature 96 } 97 98 return ENV; 99 };