|
1 | 1 | # ////////////////////////////////////////////////////////////////////////////// |
2 | 2 | # Postgres Pro. PostgreSQL Configuration Python Library. |
3 | 3 |
|
| 4 | +from __future__importannotations |
| 5 | + |
4 | 6 | from .configuration_baseimportPostgresConfiguration_Base |
5 | 7 | from .configuration_baseimportPostgresConfigurationReader_Base |
6 | 8 | from .configuration_baseimportPostgresConfigurationWriter_Base |
|
14 | 16 | from .configuration_baseimportPgCfgModel__OptionHandlerToSetValueItem |
15 | 17 | from .configuration_baseimportPgCfgModel__OptionHandlerToWrite |
16 | 18 |
|
| 19 | +from ...os.abstract.configuration_os_opsimportConfigurationOsOps |
17 | 20 | from ...os.local.configuration_os_opsimportSingleInstanceasLocalCfgOsOps |
18 | 21 |
|
19 | 22 | # fmt: off |
@@ -305,11 +308,34 @@ def __init__( |
305 | 308 | } |
306 | 309 |
|
307 | 310 | # -------------------------------------------------------------------- |
308 | | -def__init__(self,data_dir:str): |
| 311 | +def__init__(self,data_dir:str,cfgOsOps:ConfigurationOsOps=None): |
309 | 312 | asserttype(data_dir)==str |
| 313 | +assertcfgOsOpsisNoneorisinstance(cfgOsOps,ConfigurationOsOps) |
| 314 | + |
| 315 | +ifcfgOsOpsisNone: |
| 316 | +cfgOsOps=LocalCfgOsOps |
| 317 | + |
| 318 | +assertisinstance(cfgOsOps,ConfigurationOsOps) |
310 | 319 |
|
311 | 320 | super().__init__(data_dir,LocalCfgOsOps) |
312 | 321 |
|
| 322 | +# -------------------------------------------------------------------- |
| 323 | +@staticmethod |
| 324 | +defCreate(data_dir:str)->PostgresConfiguration_Std: |
| 325 | +asserttype(data_dir)==str |
| 326 | +assertisinstance(LocalCfgOsOps,ConfigurationOsOps) |
| 327 | +return__class__(data_dir,LocalCfgOsOps) |
| 328 | + |
| 329 | +# -------------------------------------------------------------------- |
| 330 | +@staticmethod |
| 331 | +defCreateWithCfgOsOps( |
| 332 | +data_dir:str, |
| 333 | +cfgOsOps:ConfigurationOsOps |
| 334 | + )->PostgresConfiguration_Std: |
| 335 | +asserttype(data_dir)==str |
| 336 | +assertisinstance(cfgOsOps,ConfigurationOsOps) |
| 337 | +return__class__(data_dir,cfgOsOps) |
| 338 | + |
313 | 339 | # PostgresConfiguration_Base interface ------------------------------- |
314 | 340 | defInternal__GetAutoConfFileName(self): |
315 | 341 | asserttype(__class__.C_POSTGRESQL_AUTO_CONF)==str |
|