Skip to content

Commit

Permalink
[Feature Flags] Give custom DC their own checked in flags. (#4934)
Browse files Browse the repository at this point in the history
Creates a local file with the feature flags to be used in Custom DC.
Sets autocomplete and place page flags to be disabled (note that the
screenshot had place experiment enabled, but it's now disabled).

Starts reading the flags for custom DC from the local file, and injects
them in the custom DC base.html file.

See how local custom DC now has the scroll to top button:
https://screenshot.googleplex.com/7dk4eim4LALCuVL
  • Loading branch information
gmechali authored Feb 6, 2025
1 parent 2f9b9f7 commit 64feb90
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
24 changes: 24 additions & 0 deletions server/config/feature_flag_configs/custom.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[{
"name": "autocomplete",
"enabled": false,
"owner": "gmechali",
"description": "Feature flag to enable place autocomplete."
},
{
"name": "dev_place_experiment",
"enabled": false,
"owner": "gmechali",
"description": "Feature flag to enable the V2 place page only for the experiment places."
},
{
"name": "dev_place_ga",
"enabled": false,
"owner": "dwnoble",
"description": "Feature flag to enable the V2 Place page to GA."
},
{
"name": "scroll_to_top_button",
"enabled": true,
"owner": "gmechali",
"description": "Feature flag to enable the scroll to top button on the explore and place pages."
}]
2 changes: 1 addition & 1 deletion server/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def load_feature_flags_from_gcs(environment: str):
def load_fallback_feature_flags(environment: str):
"""Loads the fallback feature flags into the app config. We fallback to checked in flag configs per environment."""
environments_with_local_files = set(
['local', 'autopush', 'dev', 'staging', 'production'])
['local', 'autopush', 'dev', 'staging', 'production', 'custom'])
testing_environments = set(['integration_test', 'test', 'webdriver'])

if environment in testing_environments:
Expand Down
3 changes: 3 additions & 0 deletions server/templates/custom_dc/custom/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
});
</script>
{% endif %}
<script>
globalThis.FEATURE_FLAGS = {{ config['FEATURE_FLAGS'] | tojson }};
</script>

<title>{{ title }} - Custom Data Commons</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Expand Down

0 comments on commit 64feb90

Please sign in to comment.