Skip to content

Commit

Permalink
default credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Alzpeta committed Sep 30, 2024
1 parent 64c6022 commit 437dc13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions oarepo_doi/actions/doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def credentials(self, community):
credentials_def = current_app.config.get("DATACITE_CREDENTIALS")

credentials = credentials_def.get(community, None)
if not credentials:
credentials = current_app.config.get(
"DATACITE_CREDENTIALS_DEFAULT"
)

self.username = credentials["username"]
self.password = credentials["password"]
Expand Down
7 changes: 5 additions & 2 deletions oarepo_doi/services/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ def credentials(self, community):
else:
credentials_def = current_app.config.get("DATACITE_CREDENTIALS")

credentials = credentials_def.get(community, None)

credentials = credentials_def.get(community, None)
if not credentials:
credentials = current_app.config.get(
"DATACITE_CREDENTIALS_DEFAULT"
)
self.username = credentials["username"]
self.password = credentials["password"]
self.prefix = credentials["prefix"]
Expand Down

0 comments on commit 437dc13

Please sign in to comment.