Commit 349fa7b3 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Connect to postgres with env variable PGPASSWORD

parent a1aa50b4
Pipeline #71796 passed with stage
in 33 seconds
#
# Configuration file for resif_data_reporter.py
#
logger_file: "logger.conf" # relative or absolute path for the logger configuration file
cache_ttl: 15 # Cache validity time in day
volumes: # list of directories to scan
- name: path1
path: /path/1
......@@ -18,5 +15,4 @@ postgres:
host: postgres-server # Host serving postgres
port: 5432 # Postgres port
database: statistics # Database having the dataholdings table
user: statistics
password: statistics_secret
user: statistics # Password is taken from PGPASSWORD environment variable
......@@ -170,7 +170,7 @@ def cli(configfile, force_scan, dryrun, verbose, version):
if 'postgres' in cfg:
logger.info('Writing to postgres database')
conn = psycopg2.connect(dbname=cfg['postgres']['database'], user=cfg['postgres']['user'],
host=cfg['postgres']['host'], password=cfg['postgres']['password'], port=cfg['postgres']['port'])
host=cfg['postgres']['host'], port=cfg['postgres']['port'])
cur = conn.cursor()
for stat in statistics:
try:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment