stargate / data-api

JSON document API for Apache Cassandra (formerly known as JSON API)
https://stargate.io
Apache License 2.0
13 stars 16 forks source link

Refactor feature flags to use combination of Quarkus config and per-request overrides #1335

Closed tatu-at-datastax closed 3 weeks ago

tatu-at-datastax commented 1 month ago

So: currently we have just one feature flag for enabling API Tables: it uses generic Quarkus config (via class ApiTablesConfig, setting stargate.tables.enabled). While it works ok, there are some issues:

  1. It is not grouped/named as a feature flag (minor -- but we'll get more in future)
  2. There is no way to override it on per-request basis

So we would probably want to change things so one could

  1. Have default setting (enabled/disabled) for whether API Tables are enabled
  2. Allow per-request override via HTTP headers
  3. Possibly have "master key" on whether (2) is allowed or not ("enable per-request feature flag overrides)

As to implementation, access to combined feature flag state should be via CommandContext, which can combine necessary information.

tatu-at-datastax commented 4 weeks ago

Quick note: proposed Config settings:

Matching HTTP request header will be:

tatu-at-datastax commented 3 weeks ago

Fixed via #1390