From 1bf2dc273828f8cc989dca8b2cf8f6e6c5930a0c Mon Sep 17 00:00:00 2001 From: midoks Date: Wed, 10 Aug 2022 11:22:01 +0800 Subject: [PATCH] up --- plugins/postgresql/conf/pg_hba.conf | 10 ++++++++++ plugins/postgresql/conf/postgresql.conf | 2 ++ plugins/postgresql/index.py | 8 ++++++++ 3 files changed, 20 insertions(+) create mode 100644 plugins/postgresql/conf/pg_hba.conf diff --git a/plugins/postgresql/conf/pg_hba.conf b/plugins/postgresql/conf/pg_hba.conf new file mode 100644 index 000000000..b5aee69fd --- /dev/null +++ b/plugins/postgresql/conf/pg_hba.conf @@ -0,0 +1,10 @@ +# PostgreSQL Client Authentication Configuration File + +# TYPE DATABASE USER ADDRESS METHOD +# "local" is for Unix domain socket connections only +local all all trust +host all all 127.0.0.1/32 trust +host all all ::1/128 trust +local replication all trust +host replication all 127.0.0.1/32 trust +host replication all ::1/128 trust \ No newline at end of file diff --git a/plugins/postgresql/conf/postgresql.conf b/plugins/postgresql/conf/postgresql.conf index e47d47b26..d36ddf950 100644 --- a/plugins/postgresql/conf/postgresql.conf +++ b/plugins/postgresql/conf/postgresql.conf @@ -27,4 +27,6 @@ log_destination = 'stderr' log_directory = '{$APP_PATH}/logs' log_filename = 'postgresql-%Y-%m-%d.log' log_statement = all +log_rotation_age = 7d +log_rotation_size = 100MB log_min_duration_statement = 5000 diff --git a/plugins/postgresql/index.py b/plugins/postgresql/index.py index 81861a974..c3d5593c9 100755 --- a/plugins/postgresql/index.py +++ b/plugins/postgresql/index.py @@ -188,12 +188,20 @@ def initDreplace(version=''): init_pl = conf_dir + "/init.pl" if not os.path.exists(init_pl): mw.writeFile(init_pl, 'ok') + + # postgresql.conf pg_conf = conf_dir + '/data/postgresql.conf' tpl = getPluginDir() + '/conf/postgresql.conf' content = mw.readFile(tpl) content = contentReplace(content) mw.writeFile(pg_conf, content) + # pg_hba.conf + tpl = getPluginDir() + '/conf/pg_hba.conf' + pg_hba_conf = conf_dir + '/data/pg_hba.conf' + content = mw.readFile(tpl) + mw.writeFile(pg_hba_conf, content) + logfile = runLog() if not os.path.exists(logfile): mw.writeFile(logfile, '')