Configuration¶
restgdf uses a layered configuration system based on
Pydantic Settings.
Values resolve in this order (highest precedence first):
Explicit constructor arguments — e.g.
FeatureLayer.from_url(timeout=…)``Config(…)`` instance passed explicitly
Process environment variables (
RESTGDF_*)``.env`` file in the working directory
Library defaults
Quick start¶
from restgdf import Config, get_config
# Read from environment + defaults
cfg = get_config()
# Override explicitly
cfg = Config(
transport={"timeout_total": 120},
concurrency={"max_concurrent_requests": 8},
)
Environment variables¶
All environment variables use the RESTGDF_ prefix followed by
<CATEGORY>_<FIELD> in uppercase. Legacy flat names (without category)
are supported with a DeprecationWarning.
Variable |
Default |
Description |
|---|---|---|
|
|
Total HTTP timeout in seconds |
|
|
User-Agent header value |
|
|
Global concurrency cap for parallel page fetches |
|
|
Token delivery method: |
|
|
Seconds before expiry to trigger proactive refresh |
|
|
Clock skew tolerance for token expiry comparison |
|
|
Enable retry + rate limiting (requires |
|
|
Token-bucket refill rate per service root |
|
|
Max seconds to honor from a server |
|
|
Enable OpenTelemetry spans (requires |
|
|
OTel service name for emitted spans |
Config model reference¶
- pydantic model restgdf.Config[source]¶
Bases:
BaseModelAggregate of the eight sub-configs. Frozen.
Use
get_config()(process-cached) rather than instantiating directly in production code; direct instantiation is useful for tests.- Fields:
auth (restgdf._config.AuthConfig)concurrency (restgdf._config.ConcurrencyConfig)limiter (restgdf._config.LimiterConfig)resilience (restgdf._config.ResilienceConfig)retry (restgdf._config.RetryConfig)telemetry (restgdf._config.TelemetryConfig)timeout (restgdf._config.TimeoutConfig)transport (restgdf._config.TransportConfig)
- restgdf.get_config()[source]¶
Return the process-wide cached
Configinstance.Deprecated-alias warnings emitted during env resolution attribute to the caller of
get_config()(stacklevel=3: one extra frame past theConfig.from_env()default so the warning surfaces at user code).