Skip to content

Latest commit

 

History

History
89 lines (65 loc) · 5.71 KB

File metadata and controls

89 lines (65 loc) · 5.71 KB

Application Extension

The default stac-fastapi-pgstac application comes will all extensions enabled (except transaction). Users can use ENABLED_EXTENSIONS environment variable to limit the supported extensions.

Available values for ENABLED_EXTENSIONS:

  • query
  • sort
  • fields
  • filter
  • free_text (only for collection-search)
  • pagination (see Pagination details)
  • collection_search

Example: ENABLED_EXTENSIONS="pagination,sort"

Since 6.0.0, the transaction extension is not enabled by default. To add the transaction endpoints, users can set ENABLE_TRANSACTIONS_EXTENSIONS=TRUE/YES/1.

Multi-Tenant Catalogs Extension

The optional Multi-Tenant Catalogs Extension provides discovery and management endpoints for a multi-tenant STAC architecture. It requires the stac-fastapi-catalogs-extension package to be installed.

For more information about the Multi-Tenant Catalogs specification, see StacLabs/multi-tenant-catalogs.

To enable the catalogs extension, set ENABLE_CATALOGS_EXTENSION=TRUE/YES/1.

When ENABLE_TRANSACTIONS_EXTENSIONS=TRUE, additional write endpoints are available for creating, updating, and deleting catalogs and managing relationships (linking/unlinking catalogs and collections).

Database config

  • PGUSER: postgres username
  • PGPASSWORD: postgres password
  • PGHOST: hostname for the connection
  • PGPORT: database port
  • PGDATABASE: database name
  • DB_MIN_CONN_SIZE: Number of connection the pool will be initialized with. Defaults to 1
  • DB_MAX_CONN_SIZE Max number of connections in the pool. Defaults to 10
  • DB_MAX_QUERIES: Number of queries after a connection is closed and replaced with a new connection. Defaults to 50000
  • DB_MAX_INACTIVE_CONN_LIFETIME: Number of seconds after which inactive connections in the pool will be closed. Defaults to 300
  • SEARCH_PATH: Postgres search path. Defaults to "pgstac,public"
  • APPLICATION_NAME: PgSTAC Application name. Defaults to "pgstac"
Deprecated

In version 6.0.0 we've renamed the PG configuration variable to match the official naming convention:

  • POSTGRES_USER -> PGUSER
  • POSTGRES_PASS -> PGPASSWORD
  • POSTGRES_HOST_READER -> PGHOST
  • POSTGRES_HOST_WRITER -> PGHOST*
  • POSTGRES_PORT -> PGPORT
  • POSTGRES_DBNAME -> PGDATABASE

* Since version 6.0, users cannot set a different host for writer and reader database but will need to customize the application and pass a specific stac_fastapi.pgstac.config.PostgresSettings instance to the connect_to_db function.

Validation/Serialization

  • ENABLE_RESPONSE_MODELS: use pydantic models to validate endpoint responses. Defaults to False
  • ENABLE_DIRECT_RESPONSE: by-pass the default FastAPI serialization by wrapping the endpoint responses into starlette.Response classes. Defaults to False

Pagination

The limit query parameter (or its default) will trigger pagination of Collection or Items depending on API request context when more entries exist than requested. Each following page will then be accessible from the corresponding next link in the response containing the appropriate pagination token or offset.

This PgSTAC backend only implements token-based pagination for Items and offset-based pagination for Collections. Therefore, your stac-fastapi pagination extension configuration MUST apply the corresponding implementations adequately when using this backend. Any other variant will cause search to report incorrect next links and will not yield expected Collections or Items responses. See stac-fastapi-pgstac/stac_fastapi/pgstac/app.py for a concrete example of valid configuration.

Misc

  • STAC_FASTAPI_VERSION (string) is the version number of your API instance (this is not the STAC version)
  • STAC FASTAPI_TITLE (string) should be a self-explanatory title for your API
  • STAC FASTAPI_DESCRIPTION (string) should be a good description for your API. It can contain CommonMark
  • STAC_FASTAPI_LANDING_ID (string) is a unique identifier for your Landing page
  • ROOT_PATH: set application root-path (when using proxy)
  • CORS_ORIGINS: A list of origins that should be permitted to make cross-origin requests. Defaults to *
  • CORS_ORIGIN_REGEX: A regex string to match against origins that should be permitted to make cross-origin requests. eg. 'https://.*.example.org'.
  • CORS_METHODS: A list of HTTP methods that should be allowed for cross-origin requests. Defaults to "GET,POST,OPTIONS"
  • CORS_CREDENTIALS: Set to true to enable credentials via CORS requests. Note that you'll need to set CORS_ORIGINS to something other than *, because credentials are disallowed for wildcard CORS origins.
  • CORS_HEADERS: If CORS_CREDENTIALS are true and you're using an Authorization header, set this to Content-Type,Authorization. Alternatively, you can allow all headers by setting this to *.
  • USE_API_HYDRATE: perform hydration of stac items within stac-fastapi
  • INVALID_ID_CHARS: list of characters that are not allowed in item or collection ids (used in Transaction endpoints)
  • PREFIX_PATH: An optional path prefix for the underlying FastAPI router.