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:
136
136
print (res)
137
137
```
138
138
139
+
139
140
### Custom configuration
140
141
141
142
It's often useful to extend default configuration provided by ` testgres ` .
142
143
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
145
146
lines to configuration lines:
146
147
147
148
``` python
148
- ext_conf = " shared_preload_libraries = 'postgres_fdw'\n "
149
+ ext_conf = " shared_preload_libraries = 'postgres_fdw'"
149
150
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
151
157
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
155
161
master.append_conf(' postgresql.conf' , ext_conf)
156
162
```
157
163
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
+
160
167
161
168
## Authors
162
169
You can’t perform that action at this time.
0 commit comments