Skip to content

Commit

Permalink
Merge pull request #1092 from uc-cdis/feat/indexd_password
Browse files Browse the repository at this point in the history
allow setting INDEXD_PASSWORD via env var
  • Loading branch information
jawadqur committed May 2, 2023
2 parents 4d26d1c + f9573d1 commit 97df0bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions fence/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ INDEXD: null
# this is the username which fence uses to make authenticated requests to indexd
INDEXD_USERNAME: 'fence'
# this is the password which fence uses to make authenticated requests to indexd
# can also be set via env var INDEXD_PASSWORD
INDEXD_PASSWORD: ''

# //////////////////////////////////////////////////////////////////////////////////////
Expand Down
11 changes: 11 additions & 0 deletions fence/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ def post_process(self):
"Environment variable 'DB' empty or not set: using 'DB' field from config file"
)

# allow setting INDEXD_PASSWORD via env var
if os.environ.get("INDEXD_PASSWORD"):
logger.info(
"Found environment variable 'INDEXD_PASSWORD': overriding 'INDEXD_PASSWORD' field from config file"
)
self["INDEXD_PASSWORD"] = os.environ["INDEXD_PASSWORD"]
else:
logger.debug(
"Environment variable 'INDEXD_PASSWORD' empty or not set: using 'INDEXD_PASSWORD' field from config file"
)

if "ROOT_URL" not in self._configs and "BASE_URL" in self._configs:
url = urllib.parse.urlparse(self._configs["BASE_URL"])
self._configs["ROOT_URL"] = "{}://{}".format(url.scheme, url.netloc)
Expand Down

0 comments on commit 97df0bd

Please sign in to comment.