Overview
The tif1 library provides flexible configuration through three mechanisms:- Configuration file (
.tif1rc) - Environment variables (
TIF1_*) - Runtime configuration (programmatic)
- Environment variables
- Configuration file (
.tif1rc) - Default values
Configuration File
Create a.tif1rc file in your home directory:
File Locations
The library searches for.tif1rc in this order:
- Path specified in
TIF1_CONFIG_FILEenvironment variable - Current working directory (only if
TIF1_TRUST_CWD_CONFIG=true) - Home directory (
~/.tif1rc)
Environment Variables
All configuration options can be set via environment variables:Runtime Configuration
Modify configuration programmatically:Configuration Options
Cache Settings
| Option | Type | Default | Description |
|---|---|---|---|
cache_dir | string | ~/.cache/tif1 | Cache directory path |
enable_cache | boolean | true | Enable/disable caching |
cache_commit_interval | integer | 25 | SQLite commit frequency |
sqlite_timeout | float | 30.0 | SQLite lock timeout (seconds) |
memory_cache_max_items | integer | 1024 | Max memory cache items (laps/sessions) |
memory_telemetry_cache_max_items | integer | 2048 | Max memory cache items (telemetry) |
Network Settings
| Option | Type | Default | Description |
|---|---|---|---|
timeout | integer | 30 | HTTP request timeout (seconds) |
max_retries | integer | 3 | Maximum retry attempts |
retry_backoff_factor | float | 2.0 | Exponential backoff factor |
retry_jitter | boolean | true | Add jitter to retries |
max_retry_delay | float | 60.0 | Maximum retry delay (seconds) |
max_concurrent_requests | integer | 20 | Max parallel requests |
http2_max_connections | integer | 10 | Max HTTP/2 connections |
http2_max_pool_size | integer | 20 | HTTP/2 connection pool size |
http_multiplexed | boolean | true | Enable HTTP/2 multiplexing |
http_disable_http3 | boolean | false | Disable HTTP/3 |
Circuit Breaker Settings
| Option | Type | Default | Description |
|---|---|---|---|
circuit_breaker_threshold | integer | 5 | Failures before opening circuit |
circuit_breaker_timeout | integer | 60 | Circuit reset timeout (seconds) |
Backend Settings
| Option | Type | Default | Description |
|---|---|---|---|
lib | string | "pandas" | Backend library (pandas or polars) |
polars_lap_categorical | boolean | false | Use categorical types in Polars |
Logging Settings
| Option | Type | Default | Description |
|---|---|---|---|
log_level | string | "WARNING" | Log level (DEBUG, INFO, WARNING, ERROR) |
Validation Settings
| Option | Type | Default | Description |
|---|---|---|---|
validate_data | boolean | false | Enable data validation |
validate_lap_times | boolean | false | Enable lap time validation |
validate_telemetry | boolean | false | Enable telemetry validation |
Performance Settings
| Option | Type | Default | Description |
|---|---|---|---|
max_workers | integer | 20 | Thread pool size |
json_parse_workers | integer | 0 | Process pool for JSON parsing (0=disabled) |
ultra_cold_start | boolean | true | Optimize for cold cache startup |
prefetch_driver_laps_on_get_driver | boolean | true | Prefetch driver laps |
telemetry_prefetch_max_concurrent_requests | integer | 32 | Max concurrent telemetry requests |
CDN Settings
| Option | Type | Default | Description |
|---|---|---|---|
cdns | array | ["https://cdn.jsdelivr.net/gh/TracingInsights"] | CDN base URLs |
cdn_use_minification | boolean | false | Use minified JSON |
Special Modes
| Option | Type | Default | Description |
|---|---|---|---|
offline_mode | boolean | false | Use cache only, no network |
ci_mode | boolean | false | CI/CD optimizations |
Complete Configuration Example
Here’s a complete.tif1rc file with common settings:
Environment Variables Example
Runtime Configuration Example
Configuration Best Practices
Development
Production
CI/CD
Offline Analysis
Next Steps
- Learn about caching to optimize performance
- Explore backends for choosing pandas vs polars
- Understand error handling for configuration errors