-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathinvenio.cfg
More file actions
430 lines (373 loc) · 13 KB
/
invenio.cfg
File metadata and controls
430 lines (373 loc) · 13 KB
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
"""
InvenioRDM settings for InvenioRDM Demo Site 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.
"""
from invenio_oauthclient.contrib.keycloak import KeycloakSettingsHelper
from invenio_oauthclient.contrib.orcid import ORCIDOAuthSettingsHelper
# Flask
# =====
# See https://flask.palletsprojects.com/en/1.1.x/config/
# SECURITY WARNING: keep the secret key used in production secret!
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.
TRUSTED_HOSTS = ["0.0.0.0", "localhost", "127.0.0.1"]
# Flask-SQLAlchemy
# ================
# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/
SQLALCHEMY_DATABASE_URI = (
"postgresql+psycopg2://demo-inveniordm:demo-inveniordm@localhost/demo-inveniordm"
)
# Invenio-App
# ===========
# See https://invenio-app.readthedocs.io/en/latest/configuration.html
APP_DEFAULT_SECURE_HEADERS = {
"content_security_policy": {
"default-src": [
"'self'",
"data:", # for fonts
"'unsafe-inline'", # for inline scripts and styles
"blob:", # for pdf preview
# Add your own policies here (e.g. analytics)
],
},
"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,
}
# Flask-Babel
# ===========
# See https://pythonhosted.org/Flask-Babel/#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
# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
# I18N_LANGUAGES = [
# ('fr', _('French'))
# ]
# Invenio-Theme
# =============
# See https://invenio-theme.readthedocs.io/en/latest/configuration.html
# Frontpage title
THEME_FRONTPAGE_TITLE = "Welcome to InvenioRDM's Sandbox!"
# Frontpage template
THEME_FRONTPAGE_TEMPLATE = "demo_inveniordm/demo_frontpage.html"
# Header logo
THEME_LOGO = "images/invenio-rdm.svg"
# Site tracking code template for matomo analytics
# Enable the below on the dedicated environment
# THEME_TRACKINGCODE_TEMPLATE = "demo_inveniordm/trackingcode-prod.html"
# Invenio-App-RDM
# ===============
# See https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html
# Instance's theme entrypoint file. Path relative to the ``assets/`` folder.
INSTANCE_THEME_FILE = "./less/theme.less"
# For invenio-vocabularies
JSONSCHEMAS_HOST = "localhost"
# admin user password
RDM_RECORDS_USER_FIXTURE_PASSWORDS = {"admin@inveniosoftware.org": "123456"}
# Invenio-Records-Resources
# =========================
# See https://github.com/inveniosoftware/invenio-records-resources/blob/master/invenio_records_resources/config.py
SITE_UI_URL = "https://127.0.0.1"
SITE_API_URL = "https://127.0.0.1/api"
# Invenio-RDM-Records
# ===================
# See https://github.com/inveniosoftware/invenio-rdm-records/blob/master/invenio_rdm_records/config.py
DATACITE_ENABLED = True
DATACITE_USERNAME = ""
DATACITE_PASSWORD = ""
DATACITE_PREFIX = "10.1234"
DATACITE_TEST_MODE = True
# Invenio-OAuthclient
# ===================
_keycloak_helper = KeycloakSettingsHelper(
title="CERN",
description="CERN SSO authentication",
base_url="https://auth.cern.ch/",
realm="cern",
app_key="CERN_APP_CREDENTIALS",
)
OAUTHCLIENT_CERN_REALM_URL = _keycloak_helper.realm_url
OAUTHCLIENT_CERN_USER_INFO_URL = _keycloak_helper.user_info_url
OAUTHCLIENT_CERN_VERIFY_EXP = True
OAUTHCLIENT_CERN_VERIFY_AUD = False
_orcid_sandbox_app = ORCIDOAuthSettingsHelper(
title="ORCID (Sandbox)",
description="ORCID (Sandbox) - Connecting Research and Researchers.",
base_url="https://pub.sandbox.orcid.org/",
access_token_url="https://sandbox.orcid.org/oauth/token",
authorize_url="https://sandbox.orcid.org/oauth/authorize#show_login",
)
OAUTHCLIENT_REMOTE_APPS = {
# "cern": _keycloak_helper.remote_app, # CERN login disabled
"orcid": _orcid_sandbox_app.remote_app,
}
# secrets will be injected on deployment
CERN_APP_CREDENTIALS = {
"consumer_key": "CHANGE ME",
"consumer_secret": "CHANGE ME",
}
ORCID_APP_CREDENTIALS = {
"consumer_key": "CHANGE ME",
"consumer_secret": "CHANGE ME",
}
OAISERVER_ID_PREFIX = "inveniordm.web.cern.ch"
#
# Invenio-Search
#
SEARCH_INDEX_PREFIX = "demo-inveniordm-"
# Custom Fields
# =============
from invenio_i18n import lazy_gettext as _
from invenio_rdm_records.config import RDM_FACETS, RDM_SEARCH
from invenio_rdm_records.services.schemas.metadata import _valid_url
from invenio_records_resources.services.custom_fields import (
BooleanCF,
DoubleCF,
EDTFDateStringCF,
IntegerCF,
ISODateStringCF,
TextCF,
)
from invenio_records_resources.services.records.facets import CFTermsFacet
from invenio_vocabularies.services.custom_fields import VocabularyCF
from invenio_vocabularies.services.facets import VocabularyLabels
from marshmallow import ValidationError
from marshmallow_utils.fields.edtfdatestring import EDTFValidator
#
# Namespaces
#
RDM_NAMESPACES = {"rdm": "https://inveniordm.docs.cern.ch"}
#
# Records custom fields
#
def _validate_release_year(value):
"""Accept only edtf year values i.e YYYY."""
_validate = EDTFValidator()
_value = _validate(value)
if not _value.isdigit():
raise ValidationError("Please provide a valid year.", field_name="release_year")
RDM_CUSTOM_FIELDS = [
TextCF(
name="rdm:repository_url",
field_args={"validate": _valid_url(_("Not a valid URL."))},
),
VocabularyCF(
name="rdm:development_status",
vocabulary_id="developmentstatus",
dump_options=True,
multiple=False,
),
VocabularyCF(
name="rdm:programming_languages",
vocabulary_id="programminglanguages",
dump_options=True,
multiple=True,
),
EDTFDateStringCF(
name="rdm:release_year", field_args={"validate": _validate_release_year}
),
ISODateStringCF(name="rdm:release_date"),
TextCF(name="rdm:release_notes"),
IntegerCF(name="rdm:release_number_of_lines"),
DoubleCF(name="rdm:release_test_percentage"),
BooleanCF(name="rdm:lts_release"),
]
RDM_CUSTOM_FIELDS_UI = [
{
"section": _("Software"),
"fields": [
dict(
field="rdm:repository_url",
ui_widget="Input",
props=dict(
label="Repository URL",
placeholder="https://your.repository.url",
icon="linkify",
description="URL of the repository where the software is hosted.",
),
),
dict(
field="rdm:development_status",
ui_widget="Dropdown", # predefined widget
props=dict(
label="Development Status",
placeholder="Concept, WIP, Active...",
icon="group",
description="Find more at repostatus.org",
search=False,
multiple=False,
clearable=True,
),
),
dict(
field="rdm:programming_languages",
ui_widget="AutocompleteDropdown", # predefined widget
props=dict(
label="Programming Languages",
placeholder="Type a programming language...",
icon="language",
description="List of programming fields used in this project.",
autocompleteFrom="/api/vocabularies/programminglanguages",
clearable=True,
multiple=True,
),
),
dict(
field="rdm:release_year",
ui_widget="Input",
props=dict(
label="Release Year",
placeholder="Release year (EDTF date of format YYYY).",
icon="calendar",
description="Format: DATE where DATE is YYYY.",
),
),
dict(
field="rdm:release_date",
ui_widget="Input",
props=dict(
label="Release Date",
placeholder="Release date in ISO format (YYYY-MM-DD).",
icon="calendar",
description="Format: YYYY-MM-DD.",
),
),
dict(
field="rdm:release_notes",
ui_widget="RichInput",
props=dict(
label="Release Notes",
placeholder="Added new feature X...",
icon="book",
description="Changes made in the release.",
),
),
dict(
field="rdm:release_number_of_lines",
ui_widget="NumberInput",
props=dict(
label="Release number of lines",
placeholder="Number of lines in code.",
icon="calculator",
description="Insert the integer number of code lines changed in this release.",
),
),
dict(
field="rdm:release_test_percentage",
ui_widget="NumberInput",
props=dict(
label="Release test coverage (%)",
placeholder="Release test coverage (e.g 95,75).",
icon="calculator",
description="Format: double number.",
),
),
dict(
field="rdm:lts_release",
ui_widget="BooleanCheckbox",
props=dict(
label="LTS release",
trueLabel="Yes",
falseLabel="No",
icon="tag",
description="Mark if this is a Long Term Support release (LTS).",
),
),
],
}
]
RDM_FACETS = {
**RDM_FACETS,
"development_status": {
"facet": CFTermsFacet(
field="rdm:development_status.id",
label=_("Development Status"),
value_labels=VocabularyLabels("developmentstatus"),
),
"ui": {
"field": CFTermsFacet.field("rdm:development_status"),
},
},
"programming_language": {
"facet": CFTermsFacet(
field="rdm:programming_languages.id",
label=_("Programming Languages"),
value_labels=VocabularyLabels("programminglanguages"),
),
"ui": {
"field": CFTermsFacet.field("rdm:programming_languages"),
},
},
}
RDM_SEARCH = {
**RDM_SEARCH,
"facets": RDM_SEARCH["facets"] + ["programming_language", "development_status"],
}
#
# Communities
#
COMMUNITIES_ADMINISTRATION_DISABLED = False
COMMUNITIES_SHOW_BROWSE_MENU_ENTRY = True
COMMUNITIES_CUSTOM_FIELDS = [
TextCF(
name="rdm:external_url",
field_args={"validate": _valid_url(_("Not a valid URL."))},
),
TextCF(name="rdm:policy"),
]
COMMUNITIES_CUSTOM_FIELDS_UI = [
{
"section": _("Other details"),
"fields": [
dict(
field="rdm:external_url",
ui_widget="Input",
props=dict(
label="External URL",
placeholder="https://your.community.url",
icon="linkify",
description="External URL of the community...",
),
),
dict(
field="rdm:policy",
ui_widget="RichInput",
props=dict(
label="Policy",
placeholder="For a record to be accepted into this community it must...",
icon="pencil",
description="Conditions for a record to be accepted into the community",
),
),
],
}
]
# Audit logs
AUDIT_LOGS_ENABLED = True
# FAIR Signposting
APP_RDM_RECORD_LANDING_PAGE_FAIR_SIGNPOSTING_LEVEL_1_ENABLED = True
REST_ENABLE_CORS = True