Skip to content

Commit 24da320

Browse files
committed
Enable creation of admin users
If a user under `pgpool.users` has a `admin: true` set, they will be created with the `-d` (allow CREATE DATABASE) `-r` (allow CREATE ROLE) and `-s` (superuser) flags. Fixes #3
1 parent e9da103 commit 24da320

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

jobs/postgres/spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ properties:
9393
default: ~
9494

9595
pgpool.users:
96-
description: "A list of {username: ..., password: ...} objects for defining pgpool users"
96+
description: "A list of {username: ..., password: ...} objects for defining pgpool users. Setting the 'admin:' key on a user will make them a superuser."
9797
default: []
9898

9999
pgpool.databases:

jobs/postgres/templates/bin/ctl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ EOF
109109
echo "[$(date)] setting up user <%= user['username'] %>"
110110
set -x
111111

112-
createuser -U vcap -p <%= port %> -DRS -El <%= user['username'] %>
112+
createuser -U vcap -p <%= port %> <% if user['admin'] %>-drs<% else %>-DRS<% end %> -El <%= user['username'] %>
113113
createdb -U vcap -p <%= port %> -O <%= user['username'] %> <%= user['username'] %>
114114

115115
psql -p <%= port %> -U vcap postgres -c "ALTER ROLE \"<%= user['username'] %>\" WITH PASSWORD '<%= user['password'] %>'"

templates/jobs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
password: quill
4343
- username: hedgehog
4444
password: frank
45+
admin: true
4546
- username: smoke-tests
4647
password: if-ya-got-em
4748
backend:

0 commit comments

Comments
 (0)