Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30af983

Browse files
committed
introduce default_conf()
1 parent901f0ec commit30af983

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

‎testgres/testgres.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ def init(self, allow_streaming=False, fsync=False, initdb_params=[]):
475475
"""
476476

477477
postgres_conf=os.path.join(self.data_dir,"postgresql.conf")
478-
hba_conf=os.path.join(self.data_dir,"pg_hba.conf")
479478

480479
# We don't have to reinit it if data directory exists
481480
ifos.path.isfile(postgres_conf):
@@ -485,6 +484,26 @@ def init(self, allow_streaming=False, fsync=False, initdb_params=[]):
485484
initdb_log=os.path.join(self.logs_dir,"initdb.log")
486485
_cached_initdb(self.data_dir,initdb_log,initdb_params)
487486

487+
# initialize default config files
488+
self.default_conf(fsync=fsync)
489+
490+
returnself
491+
492+
defdefault_conf(self,allow_streaming=True,fsync=False):
493+
"""
494+
Apply default settings to this node.
495+
496+
Args:
497+
allow_streaming: should this node add a hba entry for replication?
498+
fsync: should this node use fsync to keep data safe?
499+
500+
Returns:
501+
This instance of PostgresNode.
502+
"""
503+
504+
postgres_conf=os.path.join(self.data_dir,"postgresql.conf")
505+
hba_conf=os.path.join(self.data_dir,"pg_hba.conf")
506+
488507
# add parameters to hba file
489508
withopen(hba_conf,"w")asconf:
490509
conf.write("# TYPE\tDATABASE\tUSER\tADDRESS\t\tMETHOD\n"
@@ -502,9 +521,9 @@ def init(self, allow_streaming=False, fsync=False, initdb_params=[]):
502521
conf.write("fsync = off\n")
503522

504523
conf.write("log_statement = all\n"
505-
"port ={}\n".format(self.port))
506-
507-
conf.write("listen_addresses = '{}'\n".format(self.host))
524+
"listen_addresses ='{}'\n"
525+
"port = {}\n".format(self.host,
526+
self.port))
508527

509528
ifallow_streaming:
510529
cur_ver=LooseVersion(get_pg_config()["VERSION_NUM"])
@@ -516,7 +535,6 @@ def init(self, allow_streaming=False, fsync=False, initdb_params=[]):
516535
conf.write("max_wal_senders = 5\n"
517536
"wal_keep_segments = 20\n"
518537
"hot_standby = on\n"
519-
"max_connections = 10\n"
520538
"wal_level = {}\n".format(wal_level))
521539

522540
returnself

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp