-
Notifications
You must be signed in to change notification settings - Fork 11
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
Issue 0 implement feature flagging #43
Conversation
…implement-feature-flagging # Conflicts: # package-lock.json # package.json
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.
Don't have enough time this morning to do a full review yet. Just left one comment so far
|
||
const file = './codeclimbers.identity' | ||
|
||
export class FileStore implements Store { |
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.
Nice implementation! Looks like this should work well. curious why you chose to write this to file instead of the db? It does feel weird to create an entire table to store and retrieve one record
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 main reason was preventing the server and config locking each other out of the database by either both accessing the file or by them cross-depending on each other to start up.
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.
Really good work Bjorn! I'm excited to interact with this in the app
@@ -0,0 +1,30 @@ | |||
export class Flag { |
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.
Seems like a good candidate for unit tests
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 flag itself will be quick to test, would do this in the next step(including testing more stuff)
src/config/src/flagsmith.ts
Outdated
data[0].json(), | ||
data[1].json(), | ||
]) | ||
console.log(envList, idList) |
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.
Log 🙃
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.
removed, ty
src/config/src/flagsmith.ts
Outdated
} catch (error) { | ||
// @todo logging | ||
} | ||
console.log(this.flags) |
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.
Log 🙃
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.
removed, ty
// @todo log somewhere | ||
return new Flag(flagName, false, false, false, false) | ||
} | ||
private async loadFlags() { |
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.
Decent amount going on here. Are there any behaviors here we can test?
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.
Looks like there are network calls here that might make testing more difficult and I don't really care to test networking rn. Potentially could test the second half if that half is cohesive as its own function
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.
I'm happy to refactor that, would just due to size reasons not want to do the testing and refactoring here.
"url": "https://github.com/idrinth" | ||
}, | ||
"scripts": { | ||
"start": "node index.js", |
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.
What will be managing this websocket server when the CLI is distributed? Will oclif start and manage both as a systemd?
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.
that would be the intention, yes
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.
Looks good Bjorn!
The Pull Request is ready
issue-123-enable-x-does-not-disable-y
Intention
With this change I intend to provide a basic implementation for a feature flagging service.
Review Points
Please take extra care reviewing the error handling, since I had to provide a lot of fallbacks for broken configurations or unreachable remote hosts.
The code follows best practices
any
type usedNotes
This current solution uses websockets to prevent the clients from having to pull. We can easily move it to a rest-api if desired.