Appveyor.默认的Postgres凭据是什么?



Windows文档说我可以使用用户postgres和密码Password12!。我还发现了这个讨论,他们说:"我们将在下次ubuntu映像更新中修复pg_hba.conf和密码。"但这对我来说还是行不通。我也尝试过没有密码的用户postgres:没有效果,相同的认证错误。也许我只是看不见或误解了什么,这是我的基本AppVeyor配置:

version: 1.0.{build}
skip_tags: true
branches:
only:
- master
image: Ubuntu2004
services:
- postgresql
environment:
PGUSER: postgres
PGPASSWORD: Password12!
build_script:
- echo $PWD $USER $PGUSER $PGPASSWORD
- sudo psql -U postgres -c 'create database my_test_db;'

,这里是我得到的错误:

Starting 'services'
Starting PostgreSQL
Running "build_script" scripts
echo $PWD $USER $PGUSER $PGPASSWORD
/opt/appveyor/build-agent appveyor postgres Password12!
sudo psql -U postgres -c 'create database my_test_db;'
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "postgres"
Command exited with code 2
Build failed
有人能帮我一下吗?

我终于找到了解决问题的办法。正如Adrian Klaver在我的帖子下的评论中建议的那样,我检查了pg_hba.conf文件,发现在图像中Postgres被配置为使用对等身份验证。实际上,我已经从这里使用了解决方案,并将身份验证方法更改为信任。这个配置完全符合我的需要。以下是appveyor.yml的最终配置:

version: 1.0.{build}
skip_tags: true
branches:
only:
- master
image: Ubuntu2004
services:
- postgresql
environment:
PGUSER: postgres
init:
- sudo sed -i -E -e 's/(locals+alls+postgress+)peer/1trust/' /etc/postgresql/14/main/pg_hba.conf
build_script:
- psql -U postgres -c 'create database my_test_db;'

最新更新