-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/better middleware #2
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
base: development
Are you sure you want to change the base?
Changes from all commits
857c5e1
3d332d7
ee0bb4c
92dfa9c
3de432a
0eea29b
753fab4
655379d
9e968b1
48addf3
de6c681
06db677
0d17e12
976f3c5
e8e5155
8ab7cee
fe9391c
e5e440f
923f9f1
e09d66d
0a3e3a0
173e960
02a5644
f0098db
1035a81
f9fa4ce
4408f37
a5a1fa0
80aa561
9852183
e372471
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Publish MkDocs site | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - development | ||
| - 'feature/*' | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| build-deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin pymdown-extensions | ||
|
|
||
| - name: Build and deploy | ||
| run: | | ||
| mkdocs gh-deploy --force | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,3 +29,4 @@ coverage.* | |
| .vscode/ | ||
|
|
||
| site/ | ||
| ga4gh/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # syntax=docker/dockerfile:1 | ||
| FROM squidfunk/mkdocs-material:latest | ||
|
|
||
| RUN pip install --no-cache-dir mkdocs-mermaid2-plugin | ||
|
|
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,75 @@ | ||||||||||||||||||||||||||
| package handlers | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||
| "net/http" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| "github.com/gin-gonic/gin" | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // registerServiceInfoRoute adds the `/service-info` endpoint to the provided | ||||||||||||||||||||||||||
| // Gin router. The endpoint returns basic metadata about the running service | ||||||||||||||||||||||||||
| // as a JSON payload, which can be used for diagnostics and observability. | ||||||||||||||||||||||||||
| func RegisterServiceInfoRoute(r *gin.Engine) { | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| var serviceInfoResponse = map[string]any{ | ||||||||||||||||||||||||||
| "id": "drs-example", | ||||||||||||||||||||||||||
| "name": "Example DRS Service", | ||||||||||||||||||||||||||
| "type": map[string]any{ | ||||||||||||||||||||||||||
| "group": "org.ga4gh", | ||||||||||||||||||||||||||
| "artifact": "drs", | ||||||||||||||||||||||||||
| "version": "1.0.0", | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| "description": "GA4GH DRS example service", | ||||||||||||||||||||||||||
| "organization": map[string]any{ | ||||||||||||||||||||||||||
| "name": "Example Org", | ||||||||||||||||||||||||||
| "url": "https://example.org", | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| "contactUrl": "mailto:support@example.org", | ||||||||||||||||||||||||||
| "documentationUrl": "https://example.org/docs", | ||||||||||||||||||||||||||
| "createdAt": "2020-01-01T00:00:00.000Z", | ||||||||||||||||||||||||||
| "updatedAt": "2020-01-02T00:00:00.000Z", | ||||||||||||||||||||||||||
| "environment": "prod", | ||||||||||||||||||||||||||
| "version": "1.2.3", | ||||||||||||||||||||||||||
| "drs_version": "1.3.0", | ||||||||||||||||||||||||||
| "service_url": "https://drs.example.org", | ||||||||||||||||||||||||||
| "maxBulkRequestLength": 1000, // Deprecated | ||||||||||||||||||||||||||
| "timestamp": "2024-01-01T12:00:00.000Z", | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| "drs": map[string]any{ | ||||||||||||||||||||||||||
| "maxBulkRequestLength": 1000, | ||||||||||||||||||||||||||
| "objectCount": 12345, | ||||||||||||||||||||||||||
| "totalObjectSize": 987654321, | ||||||||||||||||||||||||||
| "uploadRequestSupported": true, | ||||||||||||||||||||||||||
| "objectRegistrationSupported": true, | ||||||||||||||||||||||||||
| "supportedUploadMethods": []string{ | ||||||||||||||||||||||||||
| "s3", | ||||||||||||||||||||||||||
| "gs", | ||||||||||||||||||||||||||
| "https", | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| "maxUploadSize": 1099511627776, | ||||||||||||||||||||||||||
| "maxUploadRequestLength": 100, | ||||||||||||||||||||||||||
| "maxRegisterRequestLength": 100, | ||||||||||||||||||||||||||
| "validateUploadChecksums": true, | ||||||||||||||||||||||||||
| "validateUploadFileSizes": true, | ||||||||||||||||||||||||||
| "relatedFileStorageSupported": true, | ||||||||||||||||||||||||||
| "deleteSupported": true, | ||||||||||||||||||||||||||
| "maxBulkDeleteLength": 500, | ||||||||||||||||||||||||||
| "deleteStorageDataSupported": true, | ||||||||||||||||||||||||||
| "accessMethodUpdateSupported": true, | ||||||||||||||||||||||||||
| "maxBulkAccessMethodUpdateLength": 250, | ||||||||||||||||||||||||||
| "validateAccessMethodUpdates": true, | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // Register a handler for HTTP GET requests on the `/service-info` path. | ||||||||||||||||||||||||||
| // Gin will invoke the anonymous function for each incoming request | ||||||||||||||||||||||||||
| // matching this route. | ||||||||||||||||||||||||||
| r.GET("/service-info", func(c *gin.Context) { | ||||||||||||||||||||||||||
| // Construct a JSON response using Gin's `H` helper, which is a | ||||||||||||||||||||||||||
| // shorthand for `map[string]any`. The response includes: | ||||||||||||||||||||||||||
| // * `name`: a static identifier for this service. | ||||||||||||||||||||||||||
| // * `version`: the service version read from the SERVICE_VERSION | ||||||||||||||||||||||||||
| // environment variable (may be empty if not set). | ||||||||||||||||||||||||||
| // * `timestamp`: the current UTC time, formatted as an RFC3339Nano string. | ||||||||||||||||||||||||||
|
Comment on lines
+67
to
+72
|
||||||||||||||||||||||||||
| // Construct a JSON response using Gin's `H` helper, which is a | |
| // shorthand for `map[string]any`. The response includes: | |
| // * `name`: a static identifier for this service. | |
| // * `version`: the service version read from the SERVICE_VERSION | |
| // environment variable (may be empty if not set). | |
| // * `timestamp`: the current UTC time, formatted as an RFC3339Nano string. | |
| // Return the static GA4GH DRS Service Info structure defined in | |
| // `serviceInfoResponse` above. This includes fields such as: | |
| // * top-level service metadata (e.g. `id`, `name`, `type`, `version`) | |
| // * timestamps (`createdAt`, `updatedAt`, `timestamp`) | |
| // * organization and contact details | |
| // * DRS-specific capabilities and limits under the `drs` key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dates "2020-01-01T00:00:00.000Z" and "2020-01-02T00:00:00.000Z" for createdAt and updatedAt are placeholder values from 5 years ago. For a production service, these should be replaced with actual service deployment dates or removed if they're not meaningful for this implementation.