ui: Adds easily accessible `env` for user settable 'debug' settings (#5668)

This is a synchronous only 'debug' setting accessor, uses localStorage
first and falls back to ember config.
This commit is contained in:
John Cowen 2019-04-17 09:25:08 +01:00 committed by John Cowen
parent 21732d57a8
commit cbbfaba6ac
2 changed files with 7 additions and 3 deletions

5
ui-v2/app/env.js Normal file
View File

@ -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];
}

View File

@ -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']