Configuration¶
The Config class manages client configuration from environment variables, files, and programmatic input.
Config
dataclass
¶
Configuration for MicroDC client.
Can be loaded from environment variables, config file, or passed directly.
Attributes:
| Name | Type | Description |
|---|---|---|
api_key |
str
|
MicroDC API key |
base_url |
str
|
Base URL for API |
timeout |
int
|
Request timeout in seconds |
verify_ssl |
bool
|
Whether to verify SSL certificates |
auto_start_polling |
bool
|
Automatically start polling thread |
poll_interval |
float
|
Polling interval in seconds |
max_retries |
int
|
Maximum retry attempts |
retry_backoff |
float
|
Exponential backoff multiplier |
default_model |
Optional[str]
|
Default model to use |
default_priority |
str
|
Default job priority |
Source code in microdc/core/config.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
from_env()
classmethod
¶
Load configuration from environment variables.
Environment variables
MICRODC_API_KEY: API key MICRODC_BASE_URL: Base URL MICRODC_TIMEOUT: Timeout in seconds MICRODC_VERIFY_SSL: Verify SSL (true/false) MICRODC_AUTO_POLLING: Auto start polling (true/false) MICRODC_POLL_INTERVAL: Poll interval in seconds
Source code in microdc/core/config.py
from_file(config_path='.microdc.json')
classmethod
¶
Load configuration from JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str
|
Path to config file (default: .microdc.json) |
'.microdc.json'
|
Returns:
| Type | Description |
|---|---|
Config
|
Config object |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If config file doesn't exist |
JSONDecodeError
|
If config file is invalid JSON |
Source code in microdc/core/config.py
load(config_path=None)
classmethod
¶
Load configuration from file, environment, or defaults.
Priority
- Config file (if specified)
- Environment variables
- Defaults
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Optional[str]
|
Optional path to config file |
None
|
Returns:
| Type | Description |
|---|---|
Config
|
Config object |
Source code in microdc/core/config.py
validate()
¶
Validate configuration.
Raises:
| Type | Description |
|---|---|
ValueError
|
If configuration is invalid |