API documentation
conf_path()
Returns the path found for the pg_service.conf on the system as string.
Returns:
Type | Description |
---|---|
Path
|
path to the pg_service.conf file as string |
Source code in pgserviceparser/__init__.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
full_config(conf_file_path=None)
Returns full pgservice config as configparser.ConfigParser().
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conf_file_path |
Optional[Path]
|
path to configuration file to load. If None the |
None
|
Returns:
Type | Description |
---|---|
ConfigParser
|
pg services loaded as ConfigParser |
Raises:
Type | Description |
---|---|
ServiceFileNotFound
|
when the service file is not found |
Source code in pgserviceparser/__init__.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
service_config(service_name, conf_file_path=None)
Returns the config from the given service name as a dict.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
service name |
required |
conf_file_path |
Optional[Path]
|
path to the pg_service.conf. If None the |
None
|
Returns:
Type | Description |
---|---|
dict
|
service settings as dictionary |
Raises:
Type | Description |
---|---|
ServiceNotFound
|
when the service is not found |
Source code in pgserviceparser/__init__.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
service_names(conf_file_path=None)
Returns all service names in a list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
conf_file_path |
Optional[Path]
|
path to the pg_service.conf. If None the |
None
|
Returns:
Type | Description |
---|---|
list[str]
|
list of every service registered |
Raises:
Type | Description |
---|---|
ServiceFileNotFound
|
when the service file is not found |
Source code in pgserviceparser/__init__.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
write_service(service_name, settings, conf_file_path=None)
Writes a complete service to the service file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
service name |
required |
settings |
dict
|
settings dict defining the service config |
required |
conf_file_path |
Optional[Path]
|
path to the pg_service.conf. If None the |
None
|
Raises:
Type | Description |
---|---|
ServiceFileNotFound
|
when the service file is not found |
ServiceNotFound
|
when the service is not found |
Source code in pgserviceparser/__init__.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
write_service_setting(service_name, setting_key, setting_value, conf_file_path=None)
Writes a service setting to the service file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
service_name |
str
|
service name |
required |
setting_key |
str
|
key |
required |
setting_value |
str
|
value |
required |
conf_file_path |
Optional[Path]
|
path to the pg_service.conf. If None the |
None
|
Raises:
Type | Description |
---|---|
ServiceFileNotFound
|
when the service file is not found |
ServiceNotFound
|
when the service is not found |
Source code in pgserviceparser/__init__.py
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 |
|