Settings¶
py_moodle.settings ¶
Single source of truth for configuration.
Reads environment variables following the pattern
MOODLE_<ENV>_URL
/ USERNAME
/ PASSWORD
and supports
environment-specific CAS URLs and predefined webservice tokens.
Classes:
Name | Description |
---|---|
Settings |
Holds all configuration for a specific Moodle environment. |
Functions:
Name | Description |
---|---|
load_settings |
Load settings for the requested environment. |
Classes¶
Settings
dataclass
¶
Settings(
env_name: str,
url: str,
username: str,
password: str,
use_cas: bool,
cas_url: Optional[str],
webservice_token: Optional[str],
)
Functions¶
load_settings ¶
load_settings(env: Optional[str] = None) -> Settings
Load settings for the requested environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
Optional[str]
|
Environment key ( |
None
|
Returns:
Name | Type | Description |
---|---|---|
Settings |
Settings
|
Configuration object populated for the selected environment. |
Raises:
Type | Description |
---|---|
ValueError
|
If any required core variable (URL, USERNAME, PASSWORD) is missing. |