Skip to content

Commit

Permalink
Add admin user for to reflect helm chart (#189)
Browse files Browse the repository at this point in the history
* update environment doc and allow for env variable on admin username
* enable admin user when user defined admin password
  • Loading branch information
captjt authored and CyberDem0n committed Oct 4, 2017
1 parent 924a37c commit 913125f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ENVIRONMENT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Environment Configuration Settings
- **PGROOT**: a directory where we put the pgdata (by default /home/postgres/pgroot). One may adjust it to point to the mount point of the persistent volume, such as EBS.
- **WALE_TMPDIR**: directory to store WAL-E temporary files. PGROOT/../tmp by default, make sure it has a few GBs of free space.
- **PGDATA**: location of PostgreSQL data directory, by default PGROOT/pgdata.
- **PGUSER_STANDBY**: username for the replication user, 'standby' by default.
- **PGPASSWORD_STANDBY**: a password for the replication user, 'standby' by default.
- **PGUSER_ADMIN**: username for the default admin user, 'admin' by default.
- **PGPASSWORD_ADMIN**: a password for the default admin user, 'cola' by default.
- **USE_ADMIN**: whether to use the admin user or not.
- **PGUSER_SUPERUSER**: username for the superuser, 'postgres' by default.
- **PGPASSWORD_SUPERUSER**: a password for the superuser, 'zalando' by default
- **PGPORT**: port PostgreSQL listens to for client connections, 5432 by default
- **SCOPE**: cluster name, multiple Spilos belonging to the same cluster must have identical scope.
Expand Down
11 changes: 11 additions & 0 deletions postgres-appliance/configure_spilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ def deep_update(a, b):
pg_hba:
- hostssl all all 0.0.0.0/0 md5
- host all all 0.0.0.0/0 md5
{{#USE_ADMIN}}
users:
{{PGUSER_ADMIN}}:
password: {{PGPASSWORD_ADMIN}}
options:
- createrole
- createdb
{{/USE_ADMIN}}
scope: &scope '{{SCOPE}}'
restapi:
listen: 0.0.0.0:{{APIPORT}}
Expand Down Expand Up @@ -274,6 +282,9 @@ def get_placeholders(provider):
placeholders.setdefault('PGDATA', os.path.join(placeholders['PGROOT'], 'pgdata'))
placeholders.setdefault('PGUSER_STANDBY', 'standby')
placeholders.setdefault('PGPASSWORD_STANDBY', 'standby')
placeholders.setdefault('USE_ADMIN', 'PGPASSWORD_ADMIN' in placeholders)
placeholders.setdefault('PGUSER_ADMIN', 'admin')
placeholders.setdefault('PGPASSWORD_ADMIN', 'cola')
placeholders.setdefault('PGUSER_SUPERUSER', 'postgres')
placeholders.setdefault('PGPASSWORD_SUPERUSER', 'zalando')
placeholders.setdefault('PGPORT', '5432')
Expand Down

0 comments on commit 913125f

Please sign in to comment.