Skip to content

Commit

Permalink
allow setting INDEXD_PASSWORD via env var
Browse files Browse the repository at this point in the history
  • Loading branch information
jawadqur committed Apr 26, 2023
1 parent ea1eb82 commit 62e385a
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 @@ -675,6 +675,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.info(
"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 62e385a

Please sign in to comment.