File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ # New Features
2+
3+ - Added the ` pgpool.databases ` property to auto create databases in postgres
4+ Example:
5+ ```
6+ pgpool:
7+ databases:
8+ - name: animals
9+ users:
10+ - porcupine
11+ - hedgehog
12+
13+ ```
14+
Original file line number Diff line number Diff line change @@ -89,3 +89,14 @@ properties:
8989 pgpool.users:
9090 description: "A list of {username: ..., password: ...} objects for defining pgpool users"
9191 default: []
92+
93+ pgpool.databases:
94+ description: A list of databases to create in Postgres.
95+ default: []
96+ example: |
97+ pgpool:
98+ databases:
99+ - name: animals
100+ users:
101+ - porcupine
102+ - hedgehog
Original file line number Diff line number Diff line change 119119 echo
120120
121121< % end %>
122+
123+ < % p(' pgpool.databases' , []).each do | database| %>
124+ echo >> $LOG_DIR /$JOB_NAME .log " [postgres] setting up database <%= database['name'] %>"
125+ set -x
126+
127+ createdb -U vcap -p < %= port %> -O vcap < %= database[' name' ] %>
128+
129+ < % database[' users' ].each do | user| %>
130+ psql -p < %= port %> -U vcap postgres -c " GRANT ALL PRIVILEGES ON DATABASE \" <%= database['name'] %>\" TO \" <%= user %>\" "
131+ < % end %>
132+
133+ set +x
134+ echo
135+
136+ < % end %>
137+
122138)> $LOG_DIR /user-creation.log 2>&1
123139 ;;
124140
Original file line number Diff line number Diff line change 3333 - host all all ::/0 md5
3434 pgpool :
3535 debug : true
36+ databases :
37+ - name : animals
38+ users :
39+ - porcupine
40+ - hedgehog
3641 users :
3742 - username : porcupine
3843 password : quill
You can’t perform that action at this time.
0 commit comments