Skip to content
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

Merged

Conversation

jeff-phillips-18
Copy link

No description provided.

Copy link

@cdcabrera cdcabrera left a 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]) {

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

Copy link
Author

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]) {

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'));

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]')

Copy link
Author

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

@jeff-phillips-18 jeff-phillips-18 merged commit 1d30135 into red-hat-data-services:master Apr 22, 2021
cfchase pushed a commit that referenced this pull request Apr 22, 2021
crobby pushed a commit that referenced this pull request Jun 17, 2021
@jeff-phillips-18 jeff-phillips-18 deleted the feature-flags branch November 12, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants