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