forked from zenodo/zenodo-rdm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
invenio.cfg
742 lines (637 loc) · 24 KB
/
invenio.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
"""
InvenioRDM settings for Zenodo project.
This file was automatically generated by 'invenio-cli init'.
For the full list of settings and their values, see
https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html
and the config.py files of your installed modules
https://invenio.readthedocs.io/en/latest/general/bundles.html
Only configuration created via cookiecutter or very likely to be edited
by installer are included here.
"""
import os
import socket
from celery.schedules import crontab
from copy import deepcopy
from datetime import timedelta
from celery.schedules import crontab
from invenio_administration.permissions import administration_permission
from invenio_app_rdm.config import CELERY_BEAT_SCHEDULE, APP_RDM_ROUTES, APP_RDM_DEPOSIT_FORM_DEFAULTS as DEPOSIT_FORM_DEFAULTS
from invenio_i18n import lazy_gettext as _
from invenio_oauthclient.contrib.keycloak import KeycloakSettingsHelper
from invenio_oauthclient.contrib.orcid import ORCIDOAuthSettingsHelper
from invenio_github.oauth.remote_app import github_app as github_remote_app
from invenio_rdm_records.config import (
RDM_SORT_OPTIONS as BASE_SORT_OPTIONS,
RDM_FACETS,
RDM_SEARCH_DRAFTS,
)
from invenio_rdm_records.contrib.journal import JOURNAL_SORT_OPTIONS
from invenio_rdm_records.contrib.meeting import MEETING_SORT_OPTIONS
from invenio_records_resources.services.records.queryparser import (
QueryParser,
SearchFieldTransformer,
)
from invenio_rdm_records.services.components import DefaultRecordsComponents
from invenio_oauthclient.views.client import auto_redirect_login
from invenio_communities.communities.services import facets as community_facets
from zenodo_rdm.custom_fields import CUSTOM_FIELDS_UI, CUSTOM_FIELDS, CUSTOM_FIELDS_FACETS, NAMESPACES
from zenodo_rdm.views import frontpage_view_function
from zenodo_rdm.permissions import ZenodoCommunityPermissionPolicy, ZenodoRDMRecordPermissionPolicy
from zenodo_rdm.api import ZenodoRDMRecord, ZenodoRDMDraft
from zenodo_rdm.files import storage_factory
from zenodo_rdm.legacy.resources import record_serializers
from zenodo_rdm.tokens import RATSubjectSchema
from zenodo_rdm import providers as zenodo_providers
from zenodo_rdm import facets as zenodo_community_facets
from zenodo_rdm.metrics.config import METRICS_CACHE_UPDATE_INTERVAL
from zenodo_rdm.openaire.records.components import OpenAIREComponent
from zenodo_rdm.github.schemas import CitationMetadataSchema
# Flask
# =====
# See https://flask.palletsprojects.com/en/1.1.x/config/
SECRET_KEY="CHANGE_ME"
# Since HAProxy and Nginx route all requests no matter the host header
# provided, the allowed hosts variable is set to localhost. In production it
# should be set to the correct host and it is strongly recommended to only
# route correct hosts to the application.
APP_ALLOWED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1']
APP_RDM_ROUTES["index"] = ("/", frontpage_view_function)
# Flask-SQLAlchemy
# ================
# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/
def _parse_env_bool(var_name, default=None):
if str(os.environ.get(var_name)).lower() == "true":
return True
elif str(os.environ.get(var_name)).lower() == "false":
return False
return default
SQLALCHEMY_ENGINE_OPTIONS = {
"connect_args": {"application_name": socket.gethostname()},
}
if _parse_env_bool("INVENIO_PGBOUNCER_ENABLED", False):
from sqlalchemy.pool import NullPool
SQLALCHEMY_ENGINE_OPTIONS["poolclass"] = NullPool
else:
SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://zenodo:zenodo@localhost/zenodo"
# Invenio-App
# ===========
# See https://invenio-app.readthedocs.io/en/latest/configuration.html
APP_DEFAULT_SECURE_HEADERS = {
'content_security_policy': {
'default-src': [
"'self'",
'fonts.googleapis.com', # for fonts
'*.gstatic.com', # for fonts
'data:', # for fonts
"'unsafe-inline'", # for inline scripts and styles
"'unsafe-eval'", # for webpack build
"blob:", # for pdf preview
"zenodo-broker.web.cern.ch",
"zenodo-broker-qa.web.cern.ch",
# Profiler reprot viewer dependencies
"maxcdn.bootstrapcdn.com",
"cdnjs.cloudflare.com",
"ajax.googleapis.com",
# For CERN Matomo
"webanalytics.web.cern.ch",
# For MathType - (TinyMCE Plugin)
"https://www.wiris.net",
"https://data.wiris.cloud",
],
},
'content_security_policy_report_only': False,
'content_security_policy_report_uri': None,
'force_file_save': False,
'force_https': True,
'force_https_permanent': False,
'frame_options': 'sameorigin',
'frame_options_allow_from': None,
'session_cookie_http_only': True,
'session_cookie_secure': True,
'strict_transport_security': True,
'strict_transport_security_include_subdomains': True,
'strict_transport_security_max_age': 31556926, # One year in seconds
'strict_transport_security_preload': False,
}
APP_RDM_ROUTES["index"] = ("/", frontpage_view_function)
# Celery
# ======
# Remove file integrity checks
CELERY_BEAT_SCHEDULE.pop("file-checks", None)
CELERY_BEAT_SCHEDULE.pop("file-integrity-report", None)
CELERY_BEAT_SCHEDULE = {
**CELERY_BEAT_SCHEDULE,
"metrics-calculate": {
"task": "zenodo_rdm.metrics.tasks.calculate_metrics",
"kwargs": {
"metric_id": "openaire-nexus",
},
"schedule": METRICS_CACHE_UPDATE_INTERVAL,
},
"sitemap-updater": {
"task": "zenodo_rdm.sitemap.tasks.update_sitemap_cache",
"schedule": timedelta(hours=24)
},
'openaire-failures-retry': {
'task': 'zenodo_rdm.openaire.tasks.retry_openaire_failures',
'schedule': crontab(minute=0, hour=9), # Every day at 09:00 UTC
},
"stats-export": {
"task": "zenodo_rdm.stats.tasks.export_stats",
"schedule": crontab(minute=0, hour=4),
"kwargs": {
"retry": True,
},
},
}
# Flask-Babel
# ===========
# See https://flask-babel.tkte.ch/#configuration
# Default locale (language)
BABEL_DEFAULT_LOCALE = 'en'
# Default time zone
BABEL_DEFAULT_TIMEZONE = 'Europe/Zurich'
# Invenio-I18N
# ============
# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html
BABEL_DEFAULT_LOCALE = 'en'
# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
I18N_LANGUAGES = []
# Invenio-Theme
# =============
# See https://invenio-theme.readthedocs.io/en/latest/configuration.html
# Frontpage title
THEME_FRONTPAGE_TITLE = "Zenodo"
# Header logo
THEME_LOGO = 'images/invenio-rdm.svg'
THEME_SITENAME = 'Zenodo'
# Templates
THEME_FRONTPAGE_TEMPLATE = 'zenodo_rdm/frontpage.html'
THEME_FOOTER_TEMPLATE = 'zenodo_rdm/footer.html'
# Site tracking code template for matomo analytics
# Enable the below on the dedicated environment
# THEME_TRACKINGCODE_TEMPLATE = "zenodo_rdm/trackingcode/trackingcode-qa.html"
# Invenio-App-RDM
# ===============
# See https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html
# Set default file quuota to 50GB
APP_RDM_DEPOSIT_FORM_QUOTA = {
"maxFiles": 100,
"maxStorage": 5*10**10,
}
# Instance's theme entrypoint file. Path relative to the ``assets/`` folder.
INSTANCE_THEME_FILE = './less/theme.less'
# For invenio-vocabularies
# Silent warnings
JSONSCHEMAS_HOST = "unused"
# Invenio-RDM-Records
# ===================
# See https://github.com/inveniosoftware/invenio-rdm-records/blob/master/invenio_rdm_records/config.py
DATACITE_ENABLED = True
DATACITE_PREFIX = "10.5281"
DATACITE_FORMAT = "{prefix}/zenodo.{id}"
DATACITE_TEST_MODE = True
OAISERVER_ID_PREFIX = "zenodo.org"
OAISERVER_ADMIN_EMAILS = ["[email protected]"]
RDM_ALLOW_METADATA_ONLY_RECORDS = False
RDM_ALLOW_RESTRICTED_RECORDS = False
RDM_ALLOW_EXTERNAL_DOI_VERSIONING = False
RDM_PERMISSION_POLICY = ZenodoRDMRecordPermissionPolicy
# Override record and draft API classes
RDM_RECORD_CLS = ZenodoRDMRecord
RDM_DRAFT_CLS = ZenodoRDMDraft
RDM_RECORDS_SERIALIZERS = record_serializers
RDM_PARENT_PERSISTENT_IDENTIFIER_PROVIDERS = zenodo_providers.RDM_PARENT_PERSISTENT_IDENTIFIER_PROVIDERS
RDM_PARENT_PERSISTENT_IDENTIFIERS = zenodo_providers.RDM_PARENT_PERSISTENT_IDENTIFIERS
RDM_RESOURCE_ACCESS_TOKENS_ENABLED = True
RDM_RESOURCE_ACCESS_TOKEN_REQUEST_ARG = "token"
RDM_RESOURCE_ACCESS_TOKENS_SUBJECT_SCHEMA = RATSubjectSchema
# Invenio-Search
# ==============
SEARCH_INDEX_PREFIX = "zenodo-"
INDEXER_MQ_PUBLISH_KWARGS = {
"retry": True,
"retry_policy": { # Setting for maximum waiting time of ~10min:
"interval_start": 0, # First retry immediately,
"interval_step": 2, # then increase by 2s for every retry.
"interval_max": 30, # but don't exceed 30s between retries.
"max_retries": 20, # give up after 30 tries.
},
}
ZENODO_LEGACY_SEARCH_MAP = {
"resource_type.subtype": "metadata.resource_type.props.subtype",
"resource_type.type": "metadata.resource_type.props.type",
"access_right": "access.status",
"alternate.identifier": "metadata.identifiers.identifier",
"alternate.scheme": "metadata.identifiers.scheme",
"communities": "parent.communities.ids",
"conceptdoi": "parent.pids.doi.identifier",
"conceptrecid": "parent.id",
"created": "created",
# Creators
"creators.affiliation": "metadata.creators.affiliations.name",
"creators.name": "metadata.creators.person_or_org.name",
"creators.orcid": "metadata.creators.person_or_org.identifiers.identifier",
"creators.gnd": "metadata.creators.person_or_org.identifiers.identifier",
# Contributors
"contributors.affiliation": "metadata.contributors.affiliations.name",
"contributors.name": "metadata.contributors.person_or_org.name",
"contributors.orcid": "metadata.contributors.person_or_org.identifiers.identifier",
"contributors.gnd": "metadata.contributors.person_or_org.identifiers.identifier",
"contributors.type": "metadata.contributors.role.id",
"description": "metadata.description",
"doi": "pids.doi.identifier",
"embargodate": "access.embargo.until",
"grants.code": "metadata.funding.award.number",
"grants.acronym": "metadata.funding.award.acronym",
"grants.program": "metadata.funding.award.program",
"grants.title": "metadata.funding.award.title.en",
# owner
"owners": "parent.access.owned_by.user",
# TODO: Add `grants.funder.*` mappings
"grants.funder.doi": "metadata.funding.funder.identifiers.identifier",
"grants.funder.name": "metadata.funding.funder.name",
"keywords": "metadata.subjects.subject",
"language": "metadata.languages.id",
"license.identifier": "metadata.rights.id",
"license.url": "metadata.rights.props.url",
"publicationdate": "metadata.publication_date",
"publication_date": "metadata.publication_date",
"recid": "id",
"related.identifier": "metadata.related_identifiers.identifier",
"related.scheme": "metadata.related_identifiers.scheme",
"related.relation": "metadata.related_identifiers.relation_type.id",
"title": "metadata.title",
"type": "metadata.resource_type.props.type",
"version": "versions.index",
# journal custom field mappings
"journal.title": "custom_fields.journal\:journal.title",
"journal.pages": "custom_fields.journal\:journal.pages",
"journal.volume": "custom_fields.journal\:journal.volume",
"journal.issn": "custom_fields.journal\:journal.issn",
# meeting custom field mappings
"meeting.title": "custom_fields.meeting\:meeting.title",
"meeting.acronym": "custom_fields.meeting\:meeting.acronym",
"meeting.dates": "custom_fields.meeting\:meeting.dates",
"meeting.place": "custom_fields.meeting\:meeting.place",
"meeting.url": "custom_fields.meeting\:meeting.url",
"meeting.session": "custom_fields.meeting\:meeting.session",
"meeting.session_part": "custom_fields.meeting\:meeting.session_part",
"part_of.title": "custom_fields.imprint\:imprint.title",
"part_of.pages": "custom_fields.imprint\:imprint.pages",
# imprint custom field mappings
"imprint.isbn": "custom_fields.imprint\:imprint.isbn",
"imprint.place": "custom_fields.imprint\:imprint.place",
"imprint.publisher": "custom_fields.imprint\:imprint.publisher",
# notes custom field mappings
"notes": "metadata.additional_descriptions.description",
# thesis custom field mappings
"thesis.university": "custom_fields.thesis\:university",
# Files
"filecount": "files.count",
"filename": "files.entries.key",
"filetype": "files.types",
"size": "files.totalbytes",
"_files.checksum": "files.entries.checksum",
"_files.size": "files.entries.size",
}
LEGACY_SORT_OPTIONS = {
"-bestmatch": dict(
title=_("Best match [Least relevant]"),
fields=["-_score"],
),
"publication_date": {
"title": _("Publication date [Newest]"),
"fields": ["-metadata.publication_date"],
},
"-publication_date": {
"title": _("Publication date [Oldest]"),
"fields": ["metadata.publication_date"],
},
"mostrecent": {
"title": _("Newest"),
"fields": ["-created"],
},
"-mostrecent": {
"title": _("Oldest"),
"fields": ["created"],
},
"-mostviewed": dict(
title=_("Most viewed [Least views first]"), fields=["stats.all_versions.unique_views"]
),
"journal": {
"title": _("Journal [Newest]"),
"fields": [
"-metadata.publication_date",
"custom_fields.journal:journal.volume",
"custom_fields.journal:journal.issue",
"custom_fields.journal:journal.pages",
],
},
"-journal": {
"title": _("Journal [Oldest]"),
"fields": [
"metadata.publication_date",
"custom_fields.journal:journal.volume",
"custom_fields.journal:journal.issue",
"custom_fields.journal:journal.pages",
],
},
"conference_session": {
"title": _("Conference session [Newest]"),
"fields": [
"-custom_fields.meeting:meeting.session",
"-custom_fields.meeting:meeting.session_part",
],
},
"-conference_session": {
"title": _("Conference session [Oldest]"),
"fields": [
"custom_fields.meeting:meeting.session",
"custom_fields.meeting:meeting.session_part",
],
},
"-version": dict(
title=_("Version [Oldest]"),
fields=["versions.index"],
),
}
RDM_SORT_OPTIONS = {
# base brings bestmatch, newest, oldest, updated-desc, updated-asc, versions
# FIXME: there is no conceptrecid for versions, use parent id?
**BASE_SORT_OPTIONS,
"publication-desc": {
"title": _("Published [Newest]"),
"fields": ["-metadata.publication_date"],
},
"publication-asc": {
"title": ("Published [Oldest]"),
"fields": ["metadata.publication_date"],
},
**MEETING_SORT_OPTIONS, # conference asc and desc
**JOURNAL_SORT_OPTIONS, # journal asc and desc
**LEGACY_SORT_OPTIONS # legacy sort options available only in REST API
}
RDM_SEARCH = {
"facets": ["access_status", "resource_type", "subject", "file_type"] + list(CUSTOM_FIELDS_FACETS.keys()),
"sort": [
"mostviewed",
"bestmatch",
"newest",
"oldest",
"version",
"publication-desc",
"publication-asc",
"conference-desc",
"journal-desc",
],
"query_parser_cls": QueryParser.factory(
mapping=ZENODO_LEGACY_SEARCH_MAP,
tree_transformer_cls=SearchFieldTransformer,
),
"sort_default_no_query": "newest",
"sort_default": "bestmatch",
}
COMMUNITIES_RECORDS_SEARCH = deepcopy(RDM_SEARCH)
"""Communities record search config is the same as the main record search."""
ZENODO_COMMUNITIES_FACETS = {
"type": {
"facet": community_facets.type,
"ui": {
"field": "type",
},
},
"funder": {
"facet": zenodo_community_facets.funder,
"ui": {
"field": "metadata.funding.funder",
},
},
"organization": {
"facet": zenodo_community_facets.organization,
"ui": {
"field": "metadata.organizations",
},
}
}
COMMUNITIES_FACETS = {
**ZENODO_COMMUNITIES_FACETS,
}
COMMUNITIES_SEARCH = {
"facets": ["type", "funder", "organization"],
"sort": ["bestmatch", "newest", "oldest"],
}
RDM_SEARCH_USER_COMMUNITIES = {
"facets": ["type", "funder", "organization"],
"sort": ["bestmatch", "newest", "oldest"],
}
RDM_FACETS = {
**RDM_FACETS,
**CUSTOM_FIELDS_FACETS
}
RDM_SEARCH_DRAFTS = {
**RDM_SEARCH,
"sort_default_no_query": "newest",
"sort_default": "bestmatch",
}
# User moderation feature enabled
RDM_USER_MODERATION_ENABLED = True
# Invenio-Accounts
# ================
# See https://github.com/inveniosoftware/invenio-accounts/blob/master/invenio_accounts/config.py
ACCOUNTS_LOCAL_LOGIN_ENABLED = True # enable local login
ACCOUNTS_DEFAULT_USER_VISIBILITY = "public"
SECURITY_REGISTERABLE = True # local login: allow users to register
SECURITY_RECOVERABLE = True # local login: allow users to reset the password
SECURITY_CHANGEABLE = True # local login: allow users to change psw
SECURITY_CONFIRMABLE = True # local login: users can confirm e-mail address
SECURITY_LOGIN_WITHOUT_CONFIRMATION = False # don't allow users to login without confirming
SECURITY_EMAIL_SUBJECT_REGISTER = "Welcome to Zenodo!"
PERMANENT_SESSION_LIFETIME = timedelta(days=10)
# Invenio-OAuthclient
# ===================
_orcid_helper = ORCIDOAuthSettingsHelper(
title="ORCID",
description="ORCID - Connecting Research and Researchers.",
base_url='https://api.orcid.org/',
access_token_url='https://api.orcid.org/oauth/token',
authorize_url='https://orcid.org/oauth/authorize',
)
# Openaire sandbox
_openaire_helper = KeycloakSettingsHelper(
title="OpenAIRE",
description="Open Science Services.",
base_url="https://aai.openaire.eu",
realm="openaire",
scopes="openid profile email eduperson_entitlement orcid",
app_key="OPENAIRE_APP_CREDENTIALS",
signup_options={
"auto_confirm": False,
"send_register_msg": True,
}
)
OAUTHCLIENT_OPENAIRE_AAI_VERIFY_EXP = True
OAUTHCLIENT_OPENAIRE_AAI_VERIFY_AUD = True
OAUTHCLIENT_OPENAIRE_AAI_USER_INFO_FROM_ENDPOINT = True
OAUTHCLIENT_OPENAIRE_AAI_REALM_URL = 'https://aai.openaire.eu/auth/realms/openaire'
OAUTHCLIENT_OPENAIRE_AAI_USER_INFO_URL = "https://aai.openaire.eu/auth/realms/openaire/protocol/openid-connect/userinfo"
OAUTHCLIENT_REMOTE_APPS = {
"orcid": _orcid_helper.remote_app,
"github": github_remote_app,
"openaire_aai": _openaire_helper.remote_app,
}
OAUTHCLIENT_REST_REMOTE_APPS = {
"github": github_remote_app,
}
# secrets will be injected on deployment
ORCID_APP_CREDENTIALS = {
"consumer_key": "CHANGE ME",
"consumer_secret": "CHANGE ME",
}
OPENAIRE_APP_CREDENTIALS = {
"consumer_key": "CHANGE ME",
"consumer_secret": "CHANGE ME",
}
GITHUB_APP_CREDENTIALS = {
"consumer_key": "CHANGE ME",
"consumer_secret": "CHANGE ME",
}
# OpenAIRE API configs
OPENAIRE_API_CREDENTIALS = {
"username": "CHANGE ME",
"password": "CHANGE ME"
}
"""API credentials."""
ACCOUNTS_LOGIN_VIEW_FUNCTION = auto_redirect_login # autoredirect to external login if enabled
OAUTHCLIENT_AUTO_REDIRECT_TO_EXTERNAL_LOGIN = False # autoredirect to external login
# Invenio-GitHub
# ==============
GITHUB_INTEGRATION_ENABLED = True
GITHUB_WEBHOOK_RECEIVER_ID = "github"
GITHUB_WEBHOOK_RECEIVER_URL = "CHANGE ME"
GITHUB_SHARED_SECRET = "CHANGE ME"
GITHUB_INSECURE_SSL = False
GITHUB_RELEASE_CLASS = "zenodo_rdm.github.release:ZenodoGithubRelease"
GITHUB_CITATION_METADATA_SCHEMA = CitationMetadataSchema
GITHUB_CITATION_FILE = "CITATION.cff"
# Invenio-UserProfiles
# --------------------
USERPROFILES_READ_ONLY = False # allow users to change profile info (name, email, etc...)
THEME_SHOW_FRONTPAGE_INTRO_SECTION = False
APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = "zenodo_rdm/records/detail.html"
from zenodo_rdm.utils import (
briefideas_link_render,
f1000_link_render,
github_link_render,
openaire_link_render,
reana_link_render
)
APP_RDM_RECORD_LANDING_PAGE_EXTERNAL_LINKS = [
{ "id": "f1000", "render": f1000_link_render},
{ "id": "reana", "render": reana_link_render},
{ "id": "github", "render": github_link_render},
{ "id": "briefideas", "render": briefideas_link_render},
{ "id": "openaire", "render": openaire_link_render},
]
APP_RDM_DEPOSIT_FORM_DEFAULTS = {
**DEPOSIT_FORM_DEFAULTS,
"publisher": "Zenodo",
}
"""Default values for new records in the deposit UI."""
# Invenio-Base
# ============
BLUEPRINTS_URL_PREFIXES = {
# We want to override the legacy files endpoints with our own resource/service
"invenio_files_rest": "/legacy-files",
}
# Profiler
# ========
PROFILER_PERMISSION = lambda: administration_permission.can()
# Custom Fields
# =============
RDM_NAMESPACES = NAMESPACES
RDM_CUSTOM_FIELDS = CUSTOM_FIELDS
RDM_CUSTOM_FIELDS_UI = CUSTOM_FIELDS_UI # UI components
# Invenio-Communities
# ==============
COMMUNITIES_GROUPS_ENABLED = False
COMMUNITIES_ALLOW_RESTRICTED = False
COMMUNITIES_OAI_SETS_PREFIX = "user-"
COMMUNITIES_PERMISSION_POLICY = ZenodoCommunityPermissionPolicy
COMMUNITIES_SEARCH_SORT_BY_VERIFIED = True
"""Enable the sorting of communities by verified."""
# Citations
# ==============
ZENODO_RECORDS_UI_CITATIONS_ENABLE = True
METRICS_UPTIME_ROBOT_METRIC_IDS = {}
METRICS_UPTIME_ROBOT_URL = "https://api.uptimerobot.com/v2/getMonitors"
METRICS_UPTIME_ROBOT_API_KEY = None
# OpenAIRE configs
OPENAIRE_API_URL = "http://dev.openaire.research-infrastructures.eu/is/mvc/api/results"
"""OpenAIRE API endpoint."""
# Beta configs
OPENAIRE_API_URL_BETA = None
# Other configs
OPENAIRE_PORTAL_URL = "https://explore.openaire.eu"
"""OpenAIRE portal url."""
OPENAIRE_DIRECT_INDEXING_ENABLED = True
"""Enable sending published records for direct indexing at OpenAIRE."""
RDM_RECORDS_SERVICE_COMPONENTS = DefaultRecordsComponents + [OpenAIREComponent]
"""Addd OpenAIRE component to records service."""
RDM_SEARCH_SORT_BY_VERIFIED = True
"""Enable the sorting of records by verified."""
USERS_RESOURCES_ADMINISTRATION_ENABLED = True
"""Enable user administration."""
COMMUNITIES_ADMINISTRATION_DISABLED = False
"""Enable communities administration."""
MAIL_DEFAULT_SENDER = "Zenodo <[email protected]>"
"""Default e-mail address sender."""
REST_ENABLE_CORS = True
"""Enable CORS validation."""
REST_CSRF_ENABLED = True
"""Enable CSRF."""
# Invenio logging
LOGGING_SENTRY_INIT_KWARGS = {
# instuct sentry to send user data attached to the event
"send_default_pii": True
}
THEME_TWITTERHANDLE = "@zenodo_org"
"""Twitter handle."""
# Invenio-Files-REST
# ==================
XROOTD_ENABLED = False
# control file download offloading
FILES_REST_STORAGE_FACTORY = storage_factory
FILES_REST_XSENDFILE_ENABLED = False
ZENODO_EOS_OFFLOAD_ENABLED = False
ZENODO_EOS_OFFLOAD_HTTPHOST = ""
ZENODO_EOS_OFFLOAD_REDIRECT_BASE_PATH = ""
FILES_REST_DEFAULT_QUOTA_SIZE = 5*10**10
FILES_REST_DEFAULT_MAX_FILE_SIZE = 5*10**10
# Rate limiting
RATELIMIT_PER_ENDPOINT = {
# Badges
'invenio_formatter_badges.badge': '120 per minute',
'invenio_github_badge.index': '120 per minute',
'invenio_github_badge.index_old': '120 per minute',
'invenio_github_badge.latest_doi': '120 per minute',
'invenio_github_badge.latest_doi_old': '120 per minute',
# Support
'zenodo_rdm.support_form': '10 per second',
# Login and registration
'security.login': '10 per minute',
'security.register': '10 per minute',
# Front page
'invenio_app_rdm.frontpage_view_function': '10 per second',
# Records
'invenio_app_rdm_records.record_thumbnail': '20 per second',
# OAI-PMH
'invenio_oaiserver.response': '120 per minute',
# 'zenodo_redirector.contact': '10 per second',
# TODO most similar view found was: invenio_redirector.redirect_contact
}
"""Rate limits per endpoint."""
RATELIMIT_GUEST_USER = '8000 per hour;133 per minute'
"""Rate limits for guest users."""
OAISERVER_RESUMPTION_TOKEN_EXPIRE_TIME = 1 * 120
OAISERVER_PAGE_SIZE = 100