Skip to content

Commit

Permalink
[MDS-6201] - Update Flagsmith SDKs (#3313)
Browse files Browse the repository at this point in the history
Update Flagsmith dependencies and feature flag handling

Upgraded Flagsmith versions in both Python and JavaScript dependencies for better compatibility and new features. Refined feature flag utility functions to accommodate the updated Flagsmith APIs.
  • Loading branch information
matbusby-fw authored Nov 22, 2024
1 parent dd35fa6 commit 3ddd944
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion services/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@syncfusion/ej2-react-filemanager": "27.1.55",
"@syncfusion/ej2-react-pdfviewer": "27.1.58",
"@syncfusion/ej2-splitbuttons": "27.1.56",
"flagsmith": "3.19.1",
"flagsmith": "7.0.2",
"p-limit": "3.1.0",
"query-string": "5.1.1",
"ts-loader": "9.5.1"
Expand Down
9 changes: 6 additions & 3 deletions services/core-api/app/api/utils/feature_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ def __str__(self):


flagsmith = Flagsmith(
environment_id=Config.FLAGSMITH_KEY,
api=Config.FLAGSMITH_URL,
environment_key=Config.FLAGSMITH_KEY,
api_url=Config.FLAGSMITH_URL,
)


def is_feature_enabled(feature):
try:
return flagsmith.has_feature(feature) and flagsmith.feature_enabled(feature)
feature = str(feature).strip()
flags = flagsmith.get_environment_flags()

return feature in flags.flags and flags.is_feature_enabled(feature)
except Exception as e:
current_app.logger.error(f'Failed to look up feature flag for: {feature}. ' + str(e))
return False
2 changes: 1 addition & 1 deletion services/core-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Authlib==1.3.0
cached-property==1.5.1
factory-boy==2.12.0
flagsmith==2.0.1
flagsmith==3.8.0
Flask==3.0.1
Flask-Caching==2.1.0
Flask-Cors==4.0.0
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ __metadata:
"@testing-library/jest-dom": 6.4.8
clean-webpack-plugin: 4.0.0
copy-webpack-plugin: 12.0.2
flagsmith: 3.19.1
flagsmith: 7.0.2
hard-source-webpack-plugin: 0.13.1
html-webpack-plugin: 5.6.2
image-minimizer-webpack-plugin: 4.1.0
Expand Down Expand Up @@ -9125,10 +9125,10 @@ __metadata:
languageName: node
linkType: hard

"flagsmith@npm:3.19.1":
version: 3.19.1
resolution: "flagsmith@npm:3.19.1"
checksum: df96b650a73354eb1fcba44ff94fe28c69dbb5b58061fa8782b69b8e959817a9f821070c211bbcb807bda7c9317fc954811ba055718845fb2da7cbd0028da07b
"flagsmith@npm:7.0.2":
version: 7.0.2
resolution: "flagsmith@npm:7.0.2"
checksum: c58b1340fbcac3bf2d95ae9ebd38240d196ecbee1afcacfb8919b53ad6f9041162b62361cb4f5a7cde232b062ea16a697f51de25eb12cd9b3df6154a178bff9b
languageName: node
linkType: hard

Expand Down

0 comments on commit 3ddd944

Please sign in to comment.