-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide ability to 'feature flag' an ISV App #59
Provide ability to 'feature flag' an ISV App #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, some future stuffs maybe
// TODO: Remove local quick starts when we get the correct quick starts from OpenShift | ||
const normalizedPath = path.join(__dirname, '../../../../data/quickstarts'); | ||
fs.readdirSync(normalizedPath).forEach((file) => { | ||
if (constants.yamlRegExp.test(file)) { | ||
try { | ||
const doc = jsYaml.load(fs.readFileSync(path.join(normalizedPath, file), 'utf8')); | ||
installedQuickStarts.push(doc); | ||
if (!doc.spec.featureFlag || featureFlags[doc.spec.featureFlag]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future: this may also work with just the one check and optional chaining, I'd need to fully confirm. Regardless, what you have works, pre-opt chaining
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that if there is no feature flag it is allowed, if there is a feature flag, check the flags.
fs.readdirSync(normalizedPath).forEach((file) => { | ||
if (constants.yamlRegExp.test(file)) { | ||
try { | ||
const doc = jsYaml.load(fs.readFileSync(path.join(normalizedPath, file), 'utf8')); | ||
applicationDefs.push(doc); | ||
if (!doc.spec.featureFlag || featureFlags[doc.spec.featureFlag]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future: this may also work with just the one check and optional chaining, I'd need to fully confirm. Regardless, what you have works, pre-opt chaining
const getComponentFeatureFlags = () => { | ||
const normalizedPath = path.join(__dirname, '../../data/features.json'); | ||
try { | ||
return JSON.parse(fs.readFileSync(normalizedPath, 'utf8')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
future: since not sure if that may be a file prone to update, then using what you have is good, JSON can also be brought through with a require('[your json file]')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is that the feature flags can be enabled on the deployed site
No description provided.