Closed
Description
Describe the bug
Configs: postgres auth fails after 1fed98a
Configs is not ignoring the end line in password file anymore.
To Reproduce
Steps to reproduce the behavior:
- Start Postgres with password enabled
docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=pass postgres:12-alpine -d postgres
- Create password file with end line
echo pass > password
- Start cortex with target configs
docker run --network=host -v $PWD/password:/password cortexproject/cortex:master-1fed98a -configs.database.uri=postgres://postgres@127.0.0.1/postgres?sslmode=disable -configs.database.password-file=password -target=configs
- See error authenticating:
level=info ts=2023-07-07T16:31:56.030503Z caller=main.go:194 msg="Starting Cortex" version="(version=1.14.0, branch=master, revision=1fed98a)"
level=info ts=2023-07-07T16:31:56.03981Z caller=server.go:306 http=[::]:80 grpc=[::]:9095 msg="server listening on addresses"
level=warn ts=2023-07-07T16:31:56.056675Z caller=postgres.go:62 msg="db connection not established, retrying..." err="pq: password authentication failed for user \"postgres\""
Previous commit works fine
a602a7f
docker run --network=host -v $PWD/password:/password cortexproject/cortex:master-a602a7f -configs.database.uri=postgres://postgres@127.0.0.1/postgres?sslmode=disable -configs.database.password-file=password -target=configs
Expected behavior
Auth should work. We should remove end lines after the password, so password works. I doubt anybody is using end lines as part of the password.
Additional Context
lib/pq is more pedantic after lib/pq@072e83d
and probably for good reasons.
The workaround is to create the password file without the end line:
echo -n pass > password
...