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

chore: adding feature flags json list in env variables #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tubular/scripts/frontend_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,19 @@ def get_app_config(self):
""" Combines the common and environment configs APP_CONFIG data """
app_config = self.common_cfg.get('APP_CONFIG', {})
app_config.update(self.env_cfg.get('APP_CONFIG', {}))
app_config.update(self.env_cfg.get('FEATURE_FLAGS', {}))
app_config['APP_VERSION'] = self.get_version_commit_sha()
app_config['FEATURE_FLAGS'] = self.get_feature_flags()
if not app_config:
self.LOG('Config variables do not exist for app {}.'.format(self.app_name))
return app_config

def get_feature_flags(self):
""" Accesses the feature flags from config and JSON encodes it to be placed in env variables """
feature_flags = self.env_cfg.get('FEATURE_FLAGS', {})
feature_flag_json = json.dumps(feature_flags)
return feature_flag_json

def get_version_commit_sha(self):
""" Returns the commit SHA of the current HEAD """
return LocalGitAPI(Repo(self.app_name)).get_head_sha()
Expand Down
Loading