Skip to content

Commit 2c47d66

Browse files
author
tosih
committed
Source config from file as process.env is unavailable.
1 parent 383192a commit 2c47d66

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

Gruntfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ module.exports = function(grunt) {
287287
var locals = {
288288
version: version,
289289
env: require('./client/config/json/environment.json').environment,
290-
intercomAppId: process.env.INTERCOM_APP_ID || 'xs5g95pd',
290+
intercomAppId: require('./client/config/json/environment.json').intercomAppId,
291291
commitHash: require('./client/config/json/commit.json').commitHash,
292292
commitTime: require('./client/config/json/commit.json').commitTime,
293293
apiHost: require('./client/config/json/api.json').host
@@ -478,7 +478,8 @@ module.exports = function(grunt) {
478478
},
479479
function (cb) {
480480
var configObj = {
481-
environment: environment || process.env.NODE_ENV || 'development'
481+
environment: environment || process.env.NODE_ENV || 'development',
482+
intercomAppId: process.env.INTERCOM_APP_ID || 'xs5g95pd'
482483
};
483484
var configJSON = JSON.stringify(configObj);
484485
fs.writeFile(path.join(clientPath, 'config', 'json', 'environment.json'), configJSON, function () {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
'use strict';
2+
3+
require('app')
4+
.value('intercomAppId', require('config/environment').intercomAppId);

client/services/serviceEventTracking.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require('app')
1111
var User = require('@runnable/api-client/lib/models/user');
1212
var _keypather;
1313
var _$location;
14-
var INTERCOM_APP_ID;
1514

1615
/**
1716
* EventTracking
@@ -25,9 +24,9 @@ function EventTracking(
2524
$stateParams,
2625
$window,
2726
assign,
28-
keypather
27+
keypather,
28+
intercomAppId
2929
) {
30-
INTERCOM_APP_ID = process.env.INTERCOM_APP_ID || 'xs5g95pd';
3130
_keypather = keypather;
3231
_$location = $location;
3332

@@ -122,7 +121,7 @@ EventTracking.prototype.boot = function (user, opts) {
122121
name: user.oauthName(),
123122
email: user.attrs.email,
124123
created_at: new Date(user.attrs.created) / 1000 || 0,
125-
app_id: INTERCOM_APP_ID
124+
app_id: intercomAppId
126125
};
127126
if (opts.orgName) {
128127
data.company = {

0 commit comments

Comments
 (0)