From 2c47d66e935f494ea70218c278c7b8c43e690061 Mon Sep 17 00:00:00 2001 From: tosih Date: Wed, 24 Aug 2016 15:56:19 -0700 Subject: [PATCH] Source config from file as process.env is unavailable. --- Gruntfile.js | 5 +++-- client/services/configs/serviceIntercomAppId.js | 4 ++++ client/services/serviceEventTracking.js | 7 +++---- 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 client/services/configs/serviceIntercomAppId.js diff --git a/Gruntfile.js b/Gruntfile.js index 0f217df60..afbb8c1ca 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -287,7 +287,7 @@ module.exports = function(grunt) { var locals = { version: version, env: require('./client/config/json/environment.json').environment, - intercomAppId: process.env.INTERCOM_APP_ID || 'xs5g95pd', + intercomAppId: require('./client/config/json/environment.json').intercomAppId, commitHash: require('./client/config/json/commit.json').commitHash, commitTime: require('./client/config/json/commit.json').commitTime, apiHost: require('./client/config/json/api.json').host @@ -478,7 +478,8 @@ module.exports = function(grunt) { }, function (cb) { var configObj = { - environment: environment || process.env.NODE_ENV || 'development' + environment: environment || process.env.NODE_ENV || 'development', + intercomAppId: process.env.INTERCOM_APP_ID || 'xs5g95pd' }; var configJSON = JSON.stringify(configObj); fs.writeFile(path.join(clientPath, 'config', 'json', 'environment.json'), configJSON, function () { diff --git a/client/services/configs/serviceIntercomAppId.js b/client/services/configs/serviceIntercomAppId.js new file mode 100644 index 000000000..234b58cf7 --- /dev/null +++ b/client/services/configs/serviceIntercomAppId.js @@ -0,0 +1,4 @@ +'use strict'; + +require('app') + .value('intercomAppId', require('config/environment').intercomAppId); diff --git a/client/services/serviceEventTracking.js b/client/services/serviceEventTracking.js index b21d3934e..bceb4e086 100644 --- a/client/services/serviceEventTracking.js +++ b/client/services/serviceEventTracking.js @@ -11,7 +11,6 @@ require('app') var User = require('@runnable/api-client/lib/models/user'); var _keypather; var _$location; -var INTERCOM_APP_ID; /** * EventTracking @@ -25,9 +24,9 @@ function EventTracking( $stateParams, $window, assign, - keypather + keypather, + intercomAppId ) { - INTERCOM_APP_ID = process.env.INTERCOM_APP_ID || 'xs5g95pd'; _keypather = keypather; _$location = $location; @@ -122,7 +121,7 @@ EventTracking.prototype.boot = function (user, opts) { name: user.oauthName(), email: user.attrs.email, created_at: new Date(user.attrs.created) / 1000 || 0, - app_id: INTERCOM_APP_ID + app_id: intercomAppId }; if (opts.orgName) { data.company = {