Skip to content

Commit

Permalink
Configure postgres version via PGVERSION env variable (#222)
Browse files Browse the repository at this point in the history
before that it was possible to pass postgresq.bin_dir in the SPILO_CONFIGURATION:

```yaml
postgresql:
  bin_dir: /usr/lib/postgresql/9.5/bin
```

The old method will still work and has a priority over PGVERSION.
  • Loading branch information
CyberDem0n committed May 22, 2018
1 parent 3f79d19 commit a7ebb51
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions postgres-appliance/configure_spilo.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,13 @@ def main():

config = deep_update(user_config, config)

# try to build bin_dir from PGVERSION environment variable if postgresql.bin_dir wasn't set in SPILO_CONFIGURATION
if 'bin_dir' not in config['postgresql']:
bin_dir = os.path.join('/usr/lib/postgresql', os.environ.get('PGVERSION', ''), 'bin')
postgres = os.path.join(bin_dir, 'postgres')
if os.path.isfile(postgres) and os.access(postgres, os.X_OK): # check that there is postgres binary inside
config['postgresql']['bin_dir'] = bin_dir

# Ensure replication is available
if 'pg_hba' in config['bootstrap'] and not any(['replication' in i for i in config['bootstrap']['pg_hba']]):
rep_hba = 'hostssl replication {} 0.0.0.0/0 md5'.\
Expand Down

0 comments on commit a7ebb51

Please sign in to comment.