Skip to content

Enable custom API title and description #207

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

Merged
merged 8 commits into from
Mar 12, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Added API `title`, `version`, and `description` parameters from environment variables `STAC_FASTAPI_TITLE`, `STAC_FASTAPI_VERSION` and `STAC_FASTAPI_DESCRIPTION`, respectively. [#207](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/207)

### Changed

### Fixed
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ services:
context: .
dockerfile: dockerfiles/Dockerfile.dev.es
environment:
- STAC_FASTAPI_TITLE=stac-fastapi-elasticsearch
- STAC_FASTAPI_DESCRIPTION=A STAC FastAPI with an Elasticsearch backend
- STAC_FASTAPI_VERSION=2.1
- APP_HOST=0.0.0.0
- APP_PORT=8080
- RELOAD=true
Expand Down Expand Up @@ -38,6 +41,9 @@ services:
context: .
dockerfile: dockerfiles/Dockerfile.dev.os
environment:
- STAC_FASTAPI_TITLE=stac-fastapi-opensearch
- STAC_FASTAPI_DESCRIPTION=A STAC FastAPI with an Opensearch backend
- STAC_FASTAPI_VERSION=2.1
- APP_HOST=0.0.0.0
- APP_PORT=8082
- RELOAD=true
Expand Down
4 changes: 3 additions & 1 deletion stac_fastapi/elasticsearch/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Requirements
# stac-fastapi-elasticsearch

## Requirements

The Elasticsearch backend requires **elasticsearch**.
5 changes: 5 additions & 0 deletions stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""FastAPI application."""

import os

from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.core.core import (
Expand Down Expand Up @@ -60,6 +62,9 @@
post_request_model = create_post_request_model(extensions)

api = StacApi(
title=os.getenv("STAC_FASTAPI_TITLE", "stac-fastapi-elasticsearch"),
description=os.getenv("STAC_FASTAPI_DESCRIPTION", "stac-fastapi-elasticsearch"),
api_version=os.getenv("STAC_FASTAPI_VERSION", "2.1"),
settings=settings,
extensions=extensions,
client=CoreClient(
Expand Down
6 changes: 5 additions & 1 deletion stac_fastapi/opensearch/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# stac-fastapi-opensearch
# stac-fastapi-opensearch

## Requirements

The Opensearch backend requires **opensearch**.
5 changes: 5 additions & 0 deletions stac_fastapi/opensearch/stac_fastapi/opensearch/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""FastAPI application."""

import os

from stac_fastapi.api.app import StacApi
from stac_fastapi.api.models import create_get_request_model, create_post_request_model
from stac_fastapi.core.core import (
Expand Down Expand Up @@ -60,6 +62,9 @@
post_request_model = create_post_request_model(extensions)

api = StacApi(
title=os.getenv("STAC_FASTAPI_TITLE", "stac-fastapi-opensearch"),
description=os.getenv("STAC_FASTAPI_DESCRIPTION", "stac-fastapi-opensearch"),
api_version=os.getenv("STAC_FASTAPI_VERSION", "2.1"),
settings=settings,
extensions=extensions,
client=CoreClient(
Expand Down