Skip to content

Commit

Permalink
Source config from file as process.env is unavailable.
Browse files Browse the repository at this point in the history
  • Loading branch information
tosih committed Aug 25, 2016
1 parent 320ea25 commit 021579b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 () {
Expand Down
4 changes: 4 additions & 0 deletions client/services/configs/serviceIntercomAppId.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

require('app')
.value('intercomAppId', require('config/environment').intercomAppId);
7 changes: 3 additions & 4 deletions client/services/serviceEventTracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require('app')
var User = require('@runnable/api-client/lib/models/user');
var _keypather;
var _$location;
var INTERCOM_APP_ID;

/**
* EventTracking
Expand All @@ -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;

Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 021579b

Please sign in to comment.