Skip to content

Commit

Permalink
[Issue #1688] Remove feature flag for v0.1 endpoints (#2001)
Browse files Browse the repository at this point in the history
## Summary
Fixes #1688

### Time to review: __2 mins__

## Changes proposed
Remove the `ENABLE_V_0_1_ENDPOINTS` feature flag as we just want these
endpoints enabled everywhere now

## Context for reviewers
This flag was to hide our endpoints while we built them out, we want
these enabled everywhere now, so not much reason to keep it.
  • Loading branch information
chouinar authored May 13, 2024
1 parent cf4721b commit 1979a7d
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion api/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ENABLE_OPPORTUNITY_LOG_MSG=false
############################
# Endpoint Configuration
############################
ENABLE_V_0_1_ENDPOINTS=true
# Nothing needs to be configured at the moment

############################
# Script Configuration
Expand Down
22 changes: 1 addition & 21 deletions api/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from apiflask import APIFlask, exceptions
from flask_cors import CORS
from pydantic import Field

import src.adapters.db as db
import src.adapters.db.flask_db as flask_db
Expand All @@ -19,7 +18,6 @@
from src.auth.api_key_auth import get_app_security_scheme
from src.data_migration.data_migration_blueprint import data_migration_blueprint
from src.task import task_blueprint
from src.util.env_config import PydanticBaseEnvConfig

logger = logging.getLogger(__name__)

Expand All @@ -34,17 +32,6 @@
"""


class EndpointConfig(PydanticBaseEnvConfig):
"""
Class which holds environments variables for enabling/disabling API
endpoint blueprints. Useful while we develop new endpoints that we want
to keep hidden in production (or other) environments temporarily while
we build out the features.
"""

enable_v_0_1_endpoints: bool = Field(False, alias="ENABLE_V_0_1_ENDPOINTS")


def create_app() -> APIFlask:
app = APIFlask(__name__, title=TITLE, version=API_OVERALL_VERSION)

Expand Down Expand Up @@ -111,16 +98,9 @@ def error_processor(error: exceptions.HTTPError) -> Tuple[dict, int, Any]:


def register_blueprints(app: APIFlask) -> None:
endpoint_config = EndpointConfig()

app.register_blueprint(healthcheck_blueprint)
app.register_blueprint(opportunities_v0_blueprint)
if endpoint_config.enable_v_0_1_endpoints:
logger.info("Enabling v0.1 endpoints")
app.register_blueprint(opportunities_v0_1_blueprint)
else:
logger.info("v0.1 endpoints are not enabled")

app.register_blueprint(opportunities_v0_1_blueprint)
app.register_blueprint(data_migration_blueprint)
app.register_blueprint(task_blueprint)

Expand Down
2 changes: 0 additions & 2 deletions infra/api/app-config/dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ module "dev_config" {
database_min_capacity = 2

service_override_extra_environment_variables = {
# determines whether the v0.1 endpoints are available in the API
ENABLE_V_0_1_ENDPOINTS = "true"
}
}
2 changes: 0 additions & 2 deletions infra/api/app-config/prod.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ module "prod_config" {
database_min_capacity = 2

service_override_extra_environment_variables = {
# determines whether the v0.1 endpoints are available in the API
ENABLE_V_0_1_ENDPOINTS = "false"
}
}
2 changes: 0 additions & 2 deletions infra/api/app-config/staging.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ module "staging_config" {
database_min_capacity = 2

service_override_extra_environment_variables = {
# determines whether the v0.1 endpoints are available in the API
ENABLE_V_0_1_ENDPOINTS = "true"
}
}

0 comments on commit 1979a7d

Please sign in to comment.