def parse_pg_args(args): pghost = coalesce(args.get("--pghost"), getenv('POSTGRES_HOST'), getenv('PGHOST'), 'localhost') pgport = coalesce(args.get("--pgport"), getenv('POSTGRES_PORT'), getenv('PGPORT'), '5432') dbname = coalesce(args.get("--dbname"), getenv('POSTGRES_DB'), getenv('PGDATABASE'), 'openmaptiles') user = coalesce(args.get("--user"), getenv('POSTGRES_USER'), getenv('PGUSER'), 'openmaptiles') password = coalesce(args.get("--password"), getenv('POSTGRES_PASSWORD'), getenv('PGPASSWORD'), 'openmaptiles') return pghost, pgport, dbname, user, password
def parse_pg_args(args, legacy_params=False): if legacy_params: tmp_host = args.get('--host') tmp_port = args.get('--port') tmp_db = args.get('--database') else: tmp_host, tmp_port, tmp_db = None, None, None pghost = coalesce(tmp_host, args.get('--pghost'), getenv('POSTGRES_HOST'), getenv('PGHOST'), 'localhost') pgport = coalesce(tmp_port, args.get('--pgport'), getenv('POSTGRES_PORT'), getenv('PGPORT'), '5432') dbname = coalesce(tmp_db, args.get('--dbname'), getenv('POSTGRES_DB'), getenv('PGDATABASE'), 'openmaptiles') user = coalesce(args.get('--user'), getenv('POSTGRES_USER'), getenv('PGUSER'), 'openmaptiles') password = coalesce(args.get('--password'), getenv('POSTGRES_PASSWORD'), getenv('PGPASSWORD'), 'openmaptiles') return pghost, pgport, dbname, user, password