added feature flag

This commit is contained in:
Beverly Nguyen
2025-10-14 12:37:12 -07:00
parent 1e58c3d9fa
commit f4d326738c
9 changed files with 19 additions and 3 deletions

View File

@@ -161,7 +161,7 @@
"filename": "app/config.py",
"hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc",
"is_verified": false,
"line_number": 118,
"line_number": 123,
"is_secret": false
}
],
@@ -634,5 +634,5 @@
}
]
},
"generated_at": "2025-10-07T17:43:26Z"
"generated_at": "2025-10-14T19:37:07Z"
}

View File

@@ -78,6 +78,8 @@ class Config(object):
# TODO: reassign this
NOTIFY_SERVICE_ID = "d6aa2c68-a2d9-4437-ab19-3ae8eb202553"
ORGANIZATION_DASHBOARD_ENABLED = getenv("ORGANIZATION_DASHBOARD_ENABLED", "False") == "True"
NOTIFY_BILLING_DETAILS = json.loads(getenv("NOTIFY_BILLING_DETAILS") or "null") or {
"account_number": "98765432",
"sort_code": "01-23-45",
@@ -109,6 +111,9 @@ class Development(Config):
ASSET_PATH = "/static/"
NOTIFY_LOG_LEVEL = "DEBUG"
# Feature Flags - Enable in development for testing
ORGANIZATION_DASHBOARD_ENABLED = getenv("ORGANIZATION_DASHBOARD_ENABLED", "True") == "True"
# Buckets
CSV_UPLOAD_BUCKET = _s3_credentials_from_env("CSV")
LOGO_UPLOAD_BUCKET = _s3_credentials_from_env("LOGO")

View File

@@ -2,7 +2,7 @@ from collections import OrderedDict
from datetime import datetime
from functools import partial
from flask import flash, redirect, render_template, request, url_for
from flask import current_app, flash, redirect, render_template, request, url_for
from flask_login import current_user
from app import (
@@ -70,6 +70,9 @@ def add_organization():
@main.route("/organizations/<uuid:org_id>", methods=["GET"])
@user_has_permissions()
def organization_dashboard(org_id):
if not current_app.config.get("ORGANIZATION_DASHBOARD_ENABLED", False):
return redirect(url_for(".organization_usage", org_id=org_id))
year, current_financial_year = requested_and_current_financial_year(request)
services = current_organization.services_and_usage(financial_year=year)["services"]

View File

@@ -1,6 +1,8 @@
<nav id="nav-org-nav" aria-label="Organization navigation" class="nav margin-bottom-4">
<ul class="usa-sidenav">
{% if config.ORGANIZATION_DASHBOARD_ENABLED %}
<li class="usa-sidenav__item"><a class="usa-link{{ org_navigation.is_selected('dashboard') }}" href="{{ url_for('.organization_dashboard', org_id=current_org.id) }}">Dashboard</a></li>
{% endif %}
<li class="usa-sidenav__item"><a class="usa-link{{ org_navigation.is_selected('usage') }}" href="{{ url_for('.organization_usage', org_id=current_org.id) }}">Usage</a></li>
<li class="usa-sidenav__item"><a class="usa-link{{ org_navigation.is_selected('team-members') }}" href="{{ url_for('.manage_org_users', org_id=current_org.id) }}">Team members</a></li>
{% if current_user.platform_admin %}

View File

@@ -8,3 +8,4 @@ redis_enabled: 1
nr_agent_id: '1134302465'
nr_app_id: '1083160688'
API_PUBLIC_URL: https://notify-api-demo.app.cloud.gov
ORGANIZATION_DASHBOARD_ENABLED: False

View File

@@ -8,3 +8,4 @@ redis_enabled: 1
nr_agent_id: '1050708682'
nr_app_id: '1050708682'
API_PUBLIC_URL: https://notify-api-production.app.cloud.gov
ORGANIZATION_DASHBOARD_ENABLED: False

View File

@@ -12,3 +12,4 @@ SECRET_KEY: sandbox-notify-secret-key
nr_agent_id: ''
nr_app_id: ''
NR_BROWSER_KEY: ''
ORGANIZATION_DASHBOARD_ENABLED: False

View File

@@ -8,3 +8,4 @@ redis_enabled: 1
nr_agent_id: '1134291385'
nr_app_id: '1031640326'
API_PUBLIC_URL: https://notify-api-staging.app.cloud.gov
ORGANIZATION_DASHBOARD_ENABLED: True

View File

@@ -63,3 +63,5 @@ applications:
LOGIN_DOT_GOV_CERTS_URL: ((LOGIN_DOT_GOV_CERTS_URL))
API_PUBLIC_URL: ((API_PUBLIC_URL))
ORGANIZATION_DASHBOARD_ENABLED: ((ORGANIZATION_DASHBOARD_ENABLED))