From 0beeb1f8d3d33a19031c6f4fc4b3144982110c76 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Tue, 4 Feb 2020 15:36:32 +0100 Subject: [PATCH] Rename API config to namespace as DataCite Also default admin username --- vendor/docker/env.conf | 4 ++-- viringo/config.py | 6 +++--- viringo/services/datacite.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vendor/docker/env.conf b/vendor/docker/env.conf index 201e3e9..cb67f6e 100644 --- a/vendor/docker/env.conf +++ b/vendor/docker/env.conf @@ -4,6 +4,6 @@ env DATACITE_API_URL; env OAIPMH_REPOS_NAME; env OAIPMH_ADMIN_EMAIL; env SENTRY_DSN; -env API_ADMIN_USERNAME; -env API_ADMIN_PASSWORD; +env DATACITE_API_ADMIN_USERNAME; +env DATACITE_API_ADMIN_PASSWORD; env RESULT_SET_SIZE; diff --git a/viringo/config.py b/viringo/config.py index a65636f..6e3b8b5 100644 --- a/viringo/config.py +++ b/viringo/config.py @@ -5,10 +5,10 @@ # Sentry DSN SENTRY_DSN = os.getenv('SENTRY_DSN', None) # URL used for the DataCite REST API -DATACITE_API_URL = os.getenv('DATACITE_API_URL', 'https://api.test.datacite.org') +DATACITE_API_URL = os.getenv('DATACITE_API_URL', 'https://api.datacite.org') # Admin credentials for the API -API_ADMIN_USERNAME = os.getenv('API_ADMIN_USERNAME') -API_ADMIN_PASSWORD = os.getenv('API_ADMIN_PASSWORD') +DATACITE_API_ADMIN_USERNAME = os.getenv('API_ADMIN_USERNAME', 'admin') +DATACITE_API_ADMIN_PASSWORD = os.getenv('API_ADMIN_PASSWORD') # Name used to identifier the repository. OAIPMH_REPOS_NAME = os.getenv('OAIPMH_REPOS_NAME', 'DataCite') diff --git a/viringo/services/datacite.py b/viringo/services/datacite.py index 181f105..5954f2c 100644 --- a/viringo/services/datacite.py +++ b/viringo/services/datacite.py @@ -338,7 +338,7 @@ def api_call_get(url, params=None): response = requests.get( url, params=payload_str, - auth=requests.auth.HTTPBasicAuth(config.API_ADMIN_USERNAME, config.API_ADMIN_PASSWORD) + auth=requests.auth.HTTPBasicAuth(config.DATACITE_API_ADMIN_USERNAME, config.DATACITE_API_ADMIN_PASSWORD) ) return response