diff --git a/dandiapi/api/doi.py b/dandiapi/api/doi.py index 87a0e86af..8f6377b96 100644 --- a/dandiapi/api/doi.py +++ b/dandiapi/api/doi.py @@ -15,13 +15,14 @@ def _generate_doi_data(version: Version): os.environ['DANDI_ALLOW_LOCALHOST_URLS'] = 'True' from dandischema.datacite import to_datacite + publish = settings.DANDI_DOI_PUBLISH prefix = settings.DANDI_DOI_API_PREFIX or '10.80507' dandiset_id = version.dandiset.identifier version_id = version.version doi = f'{prefix}/dandi.{dandiset_id}/{version_id}' metadata = version.metadata.metadata metadata['doi'] = doi - return (doi, to_datacite(metadata)) + return (doi, to_datacite(metadata, publish=publish)) def create_doi(version: Version) -> str: diff --git a/dandiapi/settings.py b/dandiapi/settings.py index ec0dba0fa..451e9c582 100644 --- a/dandiapi/settings.py +++ b/dandiapi/settings.py @@ -55,6 +55,7 @@ def before_binding(configuration: Type[ComposedConfiguration]): 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_PUBLISH = values.BooleanValue(environ=True, default=False) # The CloudAMQP connection was dying, using the heartbeat should keep it alive CELERY_BROKER_HEARTBEAT = 20 diff --git a/setup.py b/setup.py index b6b3dad26..11bd60be0 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ include_package_data=True, install_requires=[ 'celery', - 'dandischema>=0.3.1', + 'dandischema>=0.3.2', 'django>=3.1.2', 'django-admin-display', 'django-allauth',