refactor: 💡 remove explicit byow-pki-upstream, as it is default (#1658)
* refactor: 💡 consolidate ssh features into ssh-target flag ✅ Closes: ICU-8383 * refactor: 💡 factor out base edition * feat: 🎸 dynamic feature edition enablement and toggling * refactor: 💡 remove explicit byow-pki-upstream, as it is default ✅ Closes: ICU-8551 * refactor: 💡 extract feature flag config into separate file
This commit is contained in:
1 parent
acd719140d
commit
ee2fa6df7d
6 files changed
+69
-63
No files matched your search
@@ -5,47 +5,10 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const features = require('./features');
|
||||
|
||||
const APP_NAME = process.env.APP_NAME || 'Boundary';
|
||||
const API_HOST = process.env.API_HOST || '';
|
||||
const EDITION = process.env.EDITION || 'oss'; // Default edition is OSS
|
||||
|
||||
// Base edition declares available features, disabled by default.
|
||||
const baseEdition = {
|
||||
byow: false,
|
||||
'byow-pki-hcp-cluster-id': false,
|
||||
'byow-pki-upstream': false,
|
||||
'json-credentials': false,
|
||||
'ssh-target': false,
|
||||
'static-credentials': false,
|
||||
'target-worker-filters-v2': false,
|
||||
'target-worker-filters-v2-ingress': false,
|
||||
'target-worker-filters-v2-hcp': false,
|
||||
'target-network-address': false,
|
||||
'vault-worker-filter': false,
|
||||
};
|
||||
// Editions maps edition keys to their associated featuresets.
|
||||
const featureEditions = {};
|
||||
featureEditions.oss = {
|
||||
...baseEdition,
|
||||
byow: true,
|
||||
'byow-pki-upstream': true,
|
||||
'json-credentials': true,
|
||||
'static-credentials': true,
|
||||
'target-worker-filters-v2': true,
|
||||
'target-network-address': true,
|
||||
};
|
||||
featureEditions.enterprise = {
|
||||
...featureEditions.oss,
|
||||
'ssh-target': true,
|
||||
'target-worker-filters-v2-ingress': true,
|
||||
'vault-worker-filter': true,
|
||||
};
|
||||
featureEditions.hcp = {
|
||||
...featureEditions.enterprise,
|
||||
'byow-pki-hcp-cluster-id': true,
|
||||
'byow-pki-upstream': false,
|
||||
'target-worker-filters-v2-hcp': true,
|
||||
};
|
||||
|
||||
module.exports = function (environment) {
|
||||
let ENV = {
|
||||
@@ -135,22 +98,11 @@ module.exports = function (environment) {
|
||||
timeout: 4000,
|
||||
},
|
||||
|
||||
selectedEdition: EDITION,
|
||||
featureEditions,
|
||||
selectedEdition: features.selectedEdition,
|
||||
featureEditions: features.featureEditions,
|
||||
featureFlags: {},
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a set of features and enables them in all editions.
|
||||
* For use in development and testing only.
|
||||
*/
|
||||
const enableFeaturesInAllEditions = (features = {}) => {
|
||||
Object.entries(featureEditions).forEach(
|
||||
([key, edition]) =>
|
||||
(ENV.featureEditions[key] = { ...features, ...edition })
|
||||
);
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
// ENV.APP.LOG_RESOLVER = true;
|
||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||
@@ -174,10 +126,13 @@ module.exports = function (environment) {
|
||||
|
||||
// Default edition in development
|
||||
ENV.selectedEdition = 'enterprise';
|
||||
enableFeaturesInAllEditions({
|
||||
// Show edition toggle in UI in development
|
||||
'dev-edition-toggle': true,
|
||||
});
|
||||
features.enableFeaturesInAllEditions(
|
||||
{
|
||||
// Show edition toggle in UI in development
|
||||
'dev-edition-toggle': true,
|
||||
},
|
||||
ENV
|
||||
);
|
||||
}
|
||||
|
||||
if (environment === 'test') {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
const EDITION = process.env.EDITION || 'oss'; // Default edition is OSS
|
||||
|
||||
const selectedEdition = EDITION;
|
||||
|
||||
// Base edition declares available features, disabled by default.
|
||||
const baseEdition = {
|
||||
byow: false,
|
||||
'byow-pki-hcp-cluster-id': false,
|
||||
'json-credentials': false,
|
||||
'ssh-target': false,
|
||||
'static-credentials': false,
|
||||
'target-worker-filters-v2': false,
|
||||
'target-worker-filters-v2-ingress': false,
|
||||
'target-worker-filters-v2-hcp': false,
|
||||
'target-network-address': false,
|
||||
'vault-worker-filter': false,
|
||||
};
|
||||
// Editions maps edition keys to their associated featuresets.
|
||||
const featureEditions = {};
|
||||
featureEditions.oss = {
|
||||
...baseEdition,
|
||||
byow: true,
|
||||
'json-credentials': true,
|
||||
'static-credentials': true,
|
||||
'target-worker-filters-v2': true,
|
||||
'target-network-address': true,
|
||||
};
|
||||
featureEditions.enterprise = {
|
||||
...featureEditions.oss,
|
||||
'ssh-target': true,
|
||||
'target-worker-filters-v2-ingress': true,
|
||||
'vault-worker-filter': true,
|
||||
};
|
||||
featureEditions.hcp = {
|
||||
...featureEditions.enterprise,
|
||||
'byow-pki-hcp-cluster-id': true,
|
||||
'target-worker-filters-v2-hcp': true,
|
||||
};
|
||||
|
||||
/**
|
||||
* Takes a set of features and enables them in all editions.
|
||||
* For use in development and testing only.
|
||||
*/
|
||||
const enableFeaturesInAllEditions = (features = {}, ENV) => {
|
||||
Object.entries(featureEditions).forEach(
|
||||
([key, edition]) => (ENV.featureEditions[key] = { ...features, ...edition })
|
||||
);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
featureEditions,
|
||||
selectedEdition,
|
||||
enableFeaturesInAllEditions,
|
||||
};
|
||||
Reference in new issue
Block a user