Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 8 additions & 5 deletions API/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ Requests that may change the state (PUT & DELETE) will require authenticaiton if
In such case the authorization header must be sent with the proper API key.
Example: `authorization: ApiKey SECRET_API_KEY`

## GET `/flags/{namespace}`
## GET `/api/flags/{namespace}`
Get all the enabled feature flags in a namespace.

## HEAD `/flags/{namespace}`
## HEAD `/api/flags/{namespace}`
Check if the feature flags have been updated for a namespace. The response will contain the [etag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header.
If the etag header value is the same as in the most recent GET or HEAD request, the namespace's feature flags have not changed.

## PUT `/flags/{namespace}/{flag}`
## PUT `/api/flags/{namespace}/{flag}`
Enable a feature flag in a namespace.

## DELETE `/flags/{namespace}/{flag}`
Disable a feature flag in a namespace.
## DELETE `/api/flags/{namespace}/{flag}`
Disable a feature flag in a namespace.

## GET `/api/health`
Health check endpoint that can be used to verify the service is running in a healthy state.
10 changes: 10 additions & 0 deletions open_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ paths:
'401':
description: Unauthorized

/api/health:
get:
summary: Health check endpoint
description: Check the health status of the service and its database connection (if any)
responses:
'200':
description: Service is healthy
'503':
description: Service is unavailable

components:
schemas:
Response:
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() {
api_key: cfg.api_key(),
};
let router = Router::new()
.route("/health", get(health_check))
.route("/api/health", get(health_check))
.route("/api/flags/:namespace", get(get_ns).head(head_ns))
.route("/api/flags/:namespace/:flag", put(put_flag).delete(delete_flag))
.with_state(state);
Expand Down
101 changes: 0 additions & 101 deletions tests/health_check.rs

This file was deleted.

Loading