open-consul/ui-v2/app/instance-initializers/nspace.js
John Cowen 1b512badd7
ui: Improve configuration/env/feature flag usage (also add build time year detection) (#7072)
* Add new getEnvironment util/function

* Use new-ish `env` function in all the places

* Clean up ember env file, add year detection from commit date
2020-01-21 17:52:40 +00:00

29 lines
1 KiB
JavaScript

import { env } from 'consul-ui/env';
export function initialize(container) {
if (env('CONSUL_NSPACES_ENABLED')) {
['dc', 'settings', 'dc.intentions.edit', 'dc.intentions.create'].forEach(function(item) {
container.inject(`route:${item}`, 'nspacesRepo', 'service:repository/nspace/enabled');
container.inject(`route:nspace.${item}`, 'nspacesRepo', 'service:repository/nspace/enabled');
});
container.inject('route:application', 'nspacesRepo', 'service:repository/nspace/enabled');
container
.lookup('service:dom')
.root()
.classList.add('has-nspaces');
}
// TODO: This needs to live in its own initializer, either:
// 1. Make it be about adding classes to the root dom node
// 2. Make it be about config and things to do on initialization re: config
// If we go with 1 then we need to move both this and the above nspaces class
if (env('CONSUL_ACLS_ENABLED')) {
container
.lookup('service:dom')
.root()
.classList.add('has-acls');
}
}
export default {
initialize,
};