Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up handling of missing DOI_API_PREFIX setting #1721

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions dandiapi/api/doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ def doi_configured() -> bool:
def _generate_doi_data(version: Version):
from dandischema.datacite import to_datacite

publish = settings.DANDI_DOI_PUBLISH
# Use the DANDI test datacite instance as a placeholder if PREFIX isn't set
prefix = settings.DANDI_DOI_API_PREFIX or '10.80507'
publish: bool = settings.DANDI_DOI_PUBLISH
prefix: str = settings.DANDI_DOI_API_PREFIX
dandiset_id = version.dandiset.identifier
version_id = version.version
doi = f'{prefix}/dandi.{dandiset_id}/{version_id}'
Expand Down
7 changes: 6 additions & 1 deletion dandiapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def mutate_configuration(configuration: type[ComposedConfiguration]):
DANDI_DOI_API_URL = values.URLValue(environ=True)
DANDI_DOI_API_USER = values.Value(environ=True)
DANDI_DOI_API_PASSWORD = values.Value(environ=True)
DANDI_DOI_API_PREFIX = values.Value(environ=True)
DANDI_DOI_API_PREFIX = values.Value(environ_required=True)
DANDI_DOI_PUBLISH = values.BooleanValue(environ=True, default=False)
DANDI_WEB_APP_URL = values.URLValue(environ_required=True)
DANDI_API_URL = values.URLValue(environ_required=True)
Expand Down Expand Up @@ -151,6 +151,9 @@ class DevelopmentConfiguration(DandiMixin, DevelopmentBaseConfiguration):
'from dandiapi.api.mail import *',
]

# Use the DANDI test datacite instance as a placeholder
DANDI_DOI_API_PREFIX = '10.80507'


class TestingConfiguration(DandiMixin, TestingBaseConfiguration):
DANDI_DANDISETS_BUCKET_NAME = 'test-dandiapi-dandisets'
Expand All @@ -161,6 +164,8 @@ class TestingConfiguration(DandiMixin, TestingBaseConfiguration):
DANDI_DANDISETS_EMBARGO_LOG_BUCKET_NAME = 'test-embargo-dandiapi-dandisets-logs'
DANDI_ZARR_PREFIX_NAME = 'test-zarr'
DANDI_JUPYTERHUB_URL = 'https://hub.dandiarchive.org/'
# Use the DANDI test datacite instance as a placeholder
DANDI_DOI_API_PREFIX = '10.80507'

# This makes the dandischema pydantic model allow URLs with localhost in them.
DANDI_ALLOW_LOCALHOST_URLS = True
Expand Down
Loading