Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Oct 1, 2024
1 parent 38d4af5 commit 4779d4e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,6 @@ services:
POSTGRES_READONLY_PASSWORD: ${POSTGRES_READONLY_PASSWORD}
POSTGRES_READONLY_USER: ${POSTGRES_READONLY_USER}
volumes:
- ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- postgres_data:/var/lib/postgresql/data
- type: tmpfs
target: /dev/shm
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- SQL script to create a read-only user and grant privileges
CREATE USER ${POSTGRES_READONLY_USER} WITH PASSWORD '${POSTGRES_READONLY_PASSWORD}';

GRANT CONNECT ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_READONLY_USER};
GRANT USAGE ON SCHEMA public TO ${POSTGRES_READONLY_USER};
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ${POSTGRES_READONLY_USER};
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO ${POSTGRES_READONLY_USER};

ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO ${POSTGRES_READONLY_USER};
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON SEQUENCES TO ${POSTGRES_READONLY_USER};

0 comments on commit 4779d4e

Please sign in to comment.