File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -136,27 +136,34 @@ with testgres.get_new_node('master') as master:
136136 print (res)
137137```
138138
139+
139140### Custom configuration
140141
141142It's often useful to extend default configuration provided by ` testgres ` .
142143
143- ` testgres ` have ` default_conf ` function that helps to control some basic
144- options. The ` append_conf ` function can be used to add custom
144+ ` testgres ` has ` default_conf() ` function that helps control some basic
145+ options. The ` append_conf() ` function can be used to add custom
145146lines to configuration lines:
146147
147148``` python
148- ext_conf = " shared_preload_libraries = 'postgres_fdw'\n "
149+ ext_conf = " shared_preload_libraries = 'postgres_fdw'"
149150
150- with testgres.get_new_node(' master' ) as master:
151+ # initialize a new node
152+ with testgres.get_new_node().init() as master:
153+
154+ # ... do something ...
155+
156+ # reset main config file
151157 master.default_conf(fsync = True ,
152- unix_sockets = False ,
153- allow_streaming = True ,
154- log_statement = ' all ' )
158+ allow_streaming = True )
159+
160+ # add a new config line
155161 master.append_conf(' postgresql.conf' , ext_conf)
156162```
157163
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 ` .
164+ Note that ` default_conf() ` is called by ` init() ` function; both of them overwrite
165+ the configuration file, which means that they should be called before ` append_conf() ` .
166+
160167
161168## Authors
162169
You can’t perform that action at this time.
0 commit comments