Config
Configuration holder for connections.
Usage
Config()Parameters
host: str-
Server hostname.
port: int = 5432-
Port number.
Examples
>>> cfg = Config("localhost", 5432)
>>> cfg.host
'localhost'Methods
| Name | Description |
|---|---|
| as_dict() | Return configuration as a dictionary. |
| validate() | Validate the configuration. |
as_dict()
Return configuration as a dictionary.
Usage
as_dict()Returns
dict-
Keys are
hostandport.
validate()
Validate the configuration.
Usage
validate()Returns
bool-
True if the configuration is valid.
Raises
ValueError-
If the host is empty or port is out of range.