2534eb0908
* ui: Add Admin Partition feature flag This adds a `PartitionEnabled`/`CONSUL_PARTITIONS_ENABLED` feature flag that can be set during production form the consul binary, or additionally during development/testing via cookies. * Add partitions bookmarklet and docs, and all eng docs from main README to the docs instead. You probably already have the app running once you need these, and it reduces the amount of text/detail in the main README * Add the env variable section back into the README with actual env vars
86 lines
2.1 KiB
JavaScript
86 lines
2.1 KiB
JavaScript
/* eslint-env node */
|
|
|
|
const test = require('tape');
|
|
|
|
const getEnvironment = require('../../config/environment.js');
|
|
|
|
test(
|
|
'config has the correct environment settings',
|
|
function(t) {
|
|
[
|
|
{
|
|
environment: 'production',
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
operatorConfig: {}
|
|
},
|
|
{
|
|
environment: 'test',
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
operatorConfig: {
|
|
ACLsEnabled: true,
|
|
NamespacesEnabled: false,
|
|
SSOEnabled: false,
|
|
PartitionsEnabled: false,
|
|
LocalDatacenter: 'dc1',
|
|
}
|
|
},
|
|
{
|
|
$: {
|
|
CONSUL_NSPACES_ENABLED: 1
|
|
},
|
|
environment: 'test',
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
operatorConfig: {
|
|
ACLsEnabled: true,
|
|
NamespacesEnabled: true,
|
|
SSOEnabled: false,
|
|
PartitionsEnabled: false,
|
|
LocalDatacenter: 'dc1',
|
|
}
|
|
},
|
|
{
|
|
$: {
|
|
CONSUL_SSO_ENABLED: 1
|
|
},
|
|
environment: 'test',
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
operatorConfig: {
|
|
ACLsEnabled: true,
|
|
NamespacesEnabled: false,
|
|
SSOEnabled: true,
|
|
PartitionsEnabled: false,
|
|
LocalDatacenter: 'dc1',
|
|
}
|
|
},
|
|
{
|
|
environment: 'staging',
|
|
CONSUL_BINARY_TYPE: 'oss',
|
|
operatorConfig: {
|
|
ACLsEnabled: true,
|
|
NamespacesEnabled: true,
|
|
SSOEnabled: true,
|
|
PartitionsEnabled: true,
|
|
LocalDatacenter: 'dc1',
|
|
}
|
|
}
|
|
].forEach(
|
|
function(item) {
|
|
const env = getEnvironment(item.environment, typeof item.$ !== 'undefined' ? item.$ : undefined);
|
|
Object.keys(item).forEach(
|
|
function(key) {
|
|
if(key === '$') {
|
|
return;
|
|
}
|
|
t.deepEqual(
|
|
env[key],
|
|
item[key],
|
|
`Expect ${key} to equal ${item[key]} in the ${item.environment} environment ${typeof item.$ !== 'undefined' ? `(with ${JSON.stringify(item.$)})` : ''}`
|
|
);
|
|
}
|
|
);
|
|
}
|
|
);
|
|
t.end();
|
|
}
|
|
);
|