Skip to content

Commit 8b40272

Browse files
committed
Add documentation about custom configuration
1 parent 5a2a920 commit 8b40272

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,31 @@ with testgres.get_new_node('master') as master:
136136
print(res)
137137
```
138138

139+
### Custom configuration
140+
141+
It's often useful to extend default configuration provided by `testgres`.
142+
143+
`testgres` have `default_conf` function that helps to control some basic
144+
options. The `append_conf` function can be used to add custom
145+
lines to configuration lines:
146+
147+
```python
148+
ext_conf = "shared_preload_libraries = 'postgres_fdw'\n"
149+
150+
with testgres.get_new_node('master') as master:
151+
master.default_conf(fsync=True,
152+
unix_sockets=False,
153+
allow_streaming=True,
154+
log_statement='all')
155+
master.append_conf('postgresql.conf', ext_conf)
156+
```
157+
158+
Note that `default_conf` is called by `init` function and the latter overwrites
159+
the configuration file. That means `init` should be called before `append_conf`.
139160

140161
## Authors
141162

142-
[Ildar Musin](https://github.com/zilder) <i.musin(at)postgrespro.ru> Postgres Professional Ltd., Russia
143-
[Dmitry Ivanov](https://github.com/funbringer) <d.ivanov(at)postgrespro.ru> Postgres Professional Ltd., Russia
144-
[Ildus Kurbangaliev](https://github.com/ildus) <i.kurbangaliev(at)postgrespro.ru> Postgres Professional Ltd., Russia
163+
[Ildar Musin](https://github.com/zilder) <i.musin(at)postgrespro.ru> Postgres Professional Ltd., Russia
164+
[Dmitry Ivanov](https://github.com/funbringer) <d.ivanov(at)postgrespro.ru> Postgres Professional Ltd., Russia
165+
[Ildus Kurbangaliev](https://github.com/ildus) <i.kurbangaliev(at)postgrespro.ru> Postgres Professional Ltd., Russia
145166
[Yury Zhuravlev](https://github.com/stalkerg) <stalkerg(at)gmail.com>

0 commit comments

Comments
 (0)