Configuration
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:
querysortfieldsfilterfree_text(only for collection-search)paginationcollection_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.
Database config¶
PGUSER: postgres usernamePGPASSWORD: postgres passwordPGHOST: hostname for the connectionPGPORT: database portPGDATABASE: database nameDB_MIN_CONN_SIZE: Number of connection the pool will be initialized with. Defaults to1DB_MAX_CONN_SIZEMax number of connections in the pool. Defaults to10DB_MAX_QUERIES: Number of queries after a connection is closed and replaced with a new connection. Defaults to50000DB_MAX_INACTIVE_CONN_LIFETIME: Number of seconds after which inactive connections in the pool will be closed. Defaults to300SEARCH_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->PGUSERPOSTGRES_PASS->PGPASSWORDPOSTGRES_HOST_READER->PGHOSTPOSTGRES_HOST_WRITER->PGHOST*POSTGRES_PORT->PGPORTPOSTGRES_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 toFalseENABLE_DIRECT_RESPONSE: by-pass the default FastAPI serialization by wrapping the endpoint responses intostarlette.Responseclasses. Defaults toFalse
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 APISTAC FASTAPI_DESCRIPTION(string) should be a good description for your API. It can contain CommonMarkSTAC_FASTAPI_LANDING_ID(string) is a unique identifier for your Landing pageROOT_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 totrueto enable credentials via CORS requests. Note that you'll need to setCORS_ORIGINSto something other than*, because credentials are disallowed for wildcard CORS origins.CORS_HEADERS: IfCORS_CREDENTIALSare true and you're using anAuthorizationheader, set this toContent-Type,Authorization. Alternatively, you can allow all headers by setting this to*.USE_API_HYDRATE: perform hydration of stac items within stac-fastapiINVALID_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.