anatol / pacoloco

Caching proxy server for Arch Linux pacman
MIT License
216 stars 30 forks source link

Print user IDs instead of usernames in config sanity checks #100

Closed dezeroku closed 7 months ago

dezeroku commented 7 months ago

This resolves https://github.com/anatol/pacoloco/issues/99

With the current implementation sanity checks will fail when running the docker container as an arbitrary user (e.g. with user: 1001:1001 in docker-compose.yml):

 config.go:91: user: unknown userid 1001

This happens because the os/user implementation of Current() (see a similar issue) tries to obtain the user info based on /etc/passwd file and entry in it is not created when running a container with a specific UID:GID.

This PR changes it so UID is printed instead of the username, thus fixing the issue.

On a sidenote, we can try to get the username and fallback to printing just the user id. I am not sure if it's cleaner than going straight to the user IDs though.

anatol commented 7 months ago

The change looks good to me. If no objections I will merge it to master.

anatol commented 7 months ago

Thank you for the fix!