From f1962b1fe39ea479eee228d318f295f56c1a5deb Mon Sep 17 00:00:00 2001 From: Endial Fang Date: Tue, 14 Jul 2020 13:38:52 +0800 Subject: [PATCH] =?UTF-8?q?[fix:10]=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=B8=AD=E5=AF=B9=E6=95=B0=E6=8D=AE=E5=AD=98=E5=82=A8=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 10/prebuilds/usr/local/bin/appcommon.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/10/prebuilds/usr/local/bin/appcommon.sh b/10/prebuilds/usr/local/bin/appcommon.sh index efa1d55..aa8df1b 100644 --- a/10/prebuilds/usr/local/bin/appcommon.sh +++ b/10/prebuilds/usr/local/bin/appcommon.sh @@ -496,12 +496,18 @@ postgresql_default_hba_config() { else postgresql_password_auth_configuration fi +} + +# 生成初始 pg_hba.conf 配置 +# 全局变量: +# PG_* +postgresql_restrict_hba_config() { + LOG_I "Modify pg_hba.conf for restrict configs..." if [[ -n "$PG_PASSWORD" ]]; then LOG_I "Configuring md5 encrypt" postgresql_hba_set "trust" "md5" fi - } # 为 Slava 模式工作的节点创建 recovery.conf 文件 @@ -695,6 +701,14 @@ docker_custom_init() { # 返回值: # 布尔值 postgresql_master_init_db() { + if ! is_dir_empty "$PG_DATA_DIR"; then + LOG_E "Directory ${PG_DATA_DIR} exists but is not empty," + LOG_E "If you want to create a new database system, either remove or empty" + LOG_E "the directory ${PG_DATA_DIR}, or run initdb" + LOG_E "with an argument other than ${PG_DATA_DIR}." + exit 1 + fi + local envExtraFlags=() local initdb_args=() if [[ -n "${PG_INITDB_ARGS}" ]]; then