diff --git a/ui-v2/app/env.js b/ui-v2/app/env.js new file mode 100644 index 000000000..5b4ab0e37 --- /dev/null +++ b/ui-v2/app/env.js @@ -0,0 +1,5 @@ +import config from './config/environment'; +export default function(str) { + const user = window.localStorage.getItem(str); + return user !== null ? user : config[str]; +} diff --git a/ui-v2/app/instance-initializers/event-source.js b/ui-v2/app/instance-initializers/event-source.js index d2a707ee1..3ad5c102d 100644 --- a/ui-v2/app/instance-initializers/event-source.js +++ b/ui-v2/app/instance-initializers/event-source.js @@ -1,8 +1,7 @@ -import config from '../config/environment'; +import env from 'consul-ui/env'; -const enabled = 'CONSUL_UI_DISABLE_REALTIME'; export function initialize(container) { - if (config[enabled] || window.localStorage.getItem(enabled) !== null) { + if (env('CONSUL_UI_DISABLE_REALTIME')) { return; } ['node', 'coordinate', 'session', 'service', 'proxy']