-
Notifications
You must be signed in to change notification settings - Fork 344
/
Copy pathdefaults.py
2121 lines (1985 loc) · 58.3 KB
/
defaults.py
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
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
Base settings file, common to all environments.
These settings can be overridden in local.py.
"""
import datetime
import os
import json
import hashlib
import logging
from datetime import timedelta
from collections import OrderedDict
import enum
os_env = os.environ
def parent_dir(path):
'''Return the parent of a directory.'''
return os.path.abspath(os.path.join(path, os.pardir))
HERE = os.path.dirname(os.path.abspath(__file__))
BASE_PATH = parent_dir(HERE) # website/ directory
APP_PATH = parent_dir(BASE_PATH)
ADDON_PATH = os.path.join(APP_PATH, 'addons')
STATIC_FOLDER = os.path.join(BASE_PATH, 'static')
STATIC_URL_PATH = '/static'
ASSET_HASH_PATH = os.path.join(APP_PATH, 'webpack-assets.json')
ROOT = os.path.join(BASE_PATH, '..')
BCRYPT_LOG_ROUNDS = 12
LOG_LEVEL = logging.INFO
TEST_ENV = False
with open(os.path.join(APP_PATH, 'package.json'), 'r') as fobj:
VERSION = json.load(fobj)['version']
# Expiration time for verification key
EXPIRATION_TIME_DICT = {
'password': 24 * 60, # 24 hours in minutes for forgot and reset password
'confirm': 24 * 60, # 24 hours in minutes for confirm account and email
'claim': 30 * 24 * 60 # 30 days in minutes for claim contributor-ship
}
CITATION_STYLES_PATH = os.path.join(BASE_PATH, 'static', 'vendor', 'bower_components', 'styles')
# Minimum seconds between forgot password email attempts
SEND_EMAIL_THROTTLE = 30
# Minimum seconds between attempts to change password
CHANGE_PASSWORD_THROTTLE = 30
# Number of incorrect password attempts allowed before throttling.
INCORRECT_PASSWORD_ATTEMPTS_ALLOWED = 3
# Seconds that must elapse before updating a user's date_last_login field
DATE_LAST_LOGIN_THROTTLE = 60
DATE_LAST_LOGIN_THROTTLE_DELTA = datetime.timedelta(seconds=DATE_LAST_LOGIN_THROTTLE)
# Seconds that must elapse before change password attempts are reset(currently 1 hour)
TIME_RESET_CHANGE_PASSWORD_ATTEMPTS = 3600
# Hours before pending embargo/retraction/registration automatically becomes active
RETRACTION_PENDING_TIME = datetime.timedelta(days=2)
EMBARGO_PENDING_TIME = datetime.timedelta(days=2)
EMBARGO_TERMINATION_PENDING_TIME = datetime.timedelta(days=2)
REGISTRATION_APPROVAL_TIME = datetime.timedelta(days=2)
REGISTRATION_UPDATE_APPROVAL_TIME = datetime.timedelta(days=2)
# Date range for embargo periods
EMBARGO_END_DATE_MIN = datetime.timedelta(days=2)
EMBARGO_END_DATE_MAX = datetime.timedelta(days=1460) # Four years
# Question titles to be reomved for anonymized VOL
ANONYMIZED_TITLES = ['Authors']
LOAD_BALANCER = False
# May set these to True in local.py for development
DEV_MODE = False
DEBUG_MODE = False
SECURE_MODE = not DEBUG_MODE # Set secure cookie
PROTOCOL = 'https://' if SECURE_MODE else 'http://'
DOMAIN = PROTOCOL + 'localhost:5000/'
INTERNAL_DOMAIN = DOMAIN
API_DOMAIN = PROTOCOL + 'localhost:8000/'
PREPRINT_PROVIDER_DOMAINS = {
'enabled': False,
'prefix': PROTOCOL,
'suffix': '/'
}
# External Ember App Local Development
USE_EXTERNAL_EMBER = False
PROXY_EMBER_APPS = False
# http://docs.python-requests.org/en/master/user/advanced/#timeouts
EXTERNAL_EMBER_SERVER_TIMEOUT = 3.05
EXTERNAL_EMBER_APPS = {}
LOG_PATH = os.path.join(APP_PATH, 'logs')
TEMPLATES_PATH = os.path.join(BASE_PATH, 'templates')
# User management & registration
CONFIRM_REGISTRATIONS_BY_EMAIL = True
ALLOW_LOGIN = True
SEARCH_ENGINE = 'elastic' # Can be 'elastic', or None
ELASTIC_URI = '127.0.0.1:9200'
ELASTIC_TIMEOUT = 10
ELASTIC_INDEX = 'website'
ELASTIC_KWARGS = {
# 'use_ssl': False,
# 'verify_certs': True,
# 'ca_certs': None,
# 'client_cert': None,
# 'client_key': None
}
# Sessions
COOKIE_NAME = 'osf'
# TODO: Override OSF_COOKIE_DOMAIN in local.py in production
OSF_COOKIE_DOMAIN = None
# server-side verification timeout
OSF_SESSION_TIMEOUT = 30 * 24 * 60 * 60 # 30 days in seconds
# TODO: Override SECRET_KEY in local.py in production
SECRET_KEY = 'CHANGEME'
SESSION_COOKIE_SECURE = SECURE_MODE
SESSION_COOKIE_SAMESITE = 'None'
SESSION_COOKIE_HTTPONLY = True
# local path to private key and cert for local development using https, overwrite in local.py
OSF_SERVER_KEY = None
OSF_SERVER_CERT = None
# External services
USE_CDN_FOR_CLIENT_LIBS = True
USE_EMAIL = True
FROM_EMAIL = '[email protected]'
# support email
OSF_SUPPORT_EMAIL = '[email protected]'
# contact email
OSF_CONTACT_EMAIL = '[email protected]'
# prereg email
PREREG_EMAIL = '[email protected]'
# Default settings for fake email address generation
FAKE_EMAIL_NAME = 'freddiemercury'
FAKE_EMAIL_DOMAIN = 'cos.io'
# SMTP Settings
MAIL_SERVER = 'smtp.sendgrid.net'
MAIL_USERNAME = 'osf-smtp'
MAIL_PASSWORD = '' # Set this in local.py
# OR, if using Sendgrid's API
# WARNING: If `SENDGRID_WHITELIST_MODE` is True,
# `tasks.send_email` would only email recipients included in `SENDGRID_EMAIL_WHITELIST`
SENDGRID_API_KEY = None
SENDGRID_WHITELIST_MODE = False
SENDGRID_EMAIL_WHITELIST = []
# Mailchimp
MAILCHIMP_API_KEY = None
MAILCHIMP_WEBHOOK_SECRET_KEY = 'CHANGEME' # OSF secret key to ensure webhook is secure
ENABLE_EMAIL_SUBSCRIPTIONS = True
MAILCHIMP_GENERAL_LIST = 'Open Science Framework General'
#Triggered emails
OSF_HELP_LIST = 'Open Science Framework Help'
PREREG_AGE_LIMIT = timedelta(weeks=12)
PREREG_WAIT_TIME = timedelta(weeks=2)
WAIT_BETWEEN_MAILS = timedelta(days=7)
NO_ADDON_WAIT_TIME = timedelta(weeks=8)
NO_LOGIN_WAIT_TIME = timedelta(weeks=4)
WELCOME_OSF4M_WAIT_TIME = timedelta(weeks=2)
NO_LOGIN_OSF4M_WAIT_TIME = timedelta(weeks=6)
NEW_PUBLIC_PROJECT_WAIT_TIME = timedelta(hours=24)
WELCOME_OSF4M_WAIT_TIME_GRACE = timedelta(days=12)
# TODO: Override in local.py
MAILGUN_API_KEY = None
# Use Celery for file rendering
USE_CELERY = True
# Trashed File Retention
PURGE_DELTA = timedelta(days=30)
# TODO: Override in local.py in production
DB_HOST = 'localhost'
DB_PORT = os_env.get('OSF_DB_PORT', 27017)
# TODO: Configuration should not change between deploys - this should be dynamic.
COOKIE_DOMAIN = '.openscienceframework.org' # Beaker
# TODO: Combine Python and JavaScript config
# If you change COMMENT_MAXLENGTH, make sure you create a corresponding migration.
COMMENT_MAXLENGTH = 1000
# Profile image options
PROFILE_IMAGE_LARGE = 70
PROFILE_IMAGE_MEDIUM = 40
# Currently (8/21/2017) only gravatar supported.
PROFILE_IMAGE_PROVIDER = 'gravatar'
# Conference options
CONFERENCE_MIN_COUNT = 5
WIKI_WHITELIST = {
'tags': [
'a', 'abbr', 'acronym', 'b', 'bdo', 'big', 'blockquote', 'br',
'center', 'cite', 'code',
'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'embed', 'font',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins',
'kbd', 'li', 'object', 'ol', 'param', 'pre', 'p', 'q',
's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup',
'table', 'tbody', 'td', 'th', 'thead', 'tr', 'tt', 'ul', 'u',
'var', 'wbr',
],
'attributes': [
'align', 'alt', 'border', 'cite', 'class', 'dir',
'height', 'href', 'id', 'src', 'style', 'title', 'type', 'width',
'face', 'size', # font tags
'salign', 'align', 'wmode', 'target',
],
# Styles currently used in Reproducibility Project wiki pages
'styles': [
'top', 'left', 'width', 'height', 'position',
'background', 'font-size', 'text-align', 'z-index',
'list-style',
]
}
# Maps category identifier => Human-readable representation for use in
# titles, menus, etc.
# Use an OrderedDict so that menu items show in the correct order
NODE_CATEGORY_MAP = OrderedDict([
('analysis', 'Analysis'),
('communication', 'Communication'),
('data', 'Data'),
('hypothesis', 'Hypothesis'),
('instrumentation', 'Instrumentation'),
('methods and measures', 'Methods and Measures'),
('procedure', 'Procedure'),
('project', 'Project'),
('software', 'Software'),
('other', 'Other'),
('', 'Uncategorized')
])
# Add-ons
# Load addons from addons.json
with open(os.path.join(ROOT, 'addons.json')) as fp:
addon_settings = json.load(fp)
ADDONS_REQUESTED = addon_settings['addons']
ADDONS_ARCHIVABLE = addon_settings['addons_archivable']
ADDONS_COMMENTABLE = addon_settings['addons_commentable']
ADDONS_BASED_ON_IDS = addon_settings['addons_based_on_ids']
ADDONS_DEFAULT = addon_settings['addons_default']
ADDONS_OAUTH_NO_REDIRECT = addon_settings['addons_oauth_no_redirect']
SYSTEM_ADDED_ADDONS = {
'user': [],
'node': [],
}
KEEN = {
'public': {
'project_id': None,
'master_key': 'changeme',
'write_key': '',
'read_key': '',
},
'private': {
'project_id': '',
'write_key': '',
'read_key': '',
},
}
SENTRY_DSN = None
SENTRY_DSN_JS = None
MISSING_FILE_NAME = 'untitled'
# Most Popular and New and Noteworthy Nodes
POPULAR_LINKS_NODE = None # TODO Override in local.py in production.
POPULAR_LINKS_REGISTRATIONS = None # TODO Override in local.py in production.
NEW_AND_NOTEWORTHY_LINKS_NODE = None # TODO Override in local.py in production.
MAX_POPULAR_PROJECTS = 10
NEW_AND_NOTEWORTHY_CONTRIBUTOR_BLACKLIST = [] # TODO Override in local.py in production.
# FOR EMERGENCIES ONLY: Setting this to True will disable forks, registrations,
# and uploads in order to save disk space.
DISK_SAVING_MODE = False
# Seconds before another notification email can be sent to a contributor when added to a project
CONTRIBUTOR_ADDED_EMAIL_THROTTLE = 24 * 3600
# Seconds before another notification email can be sent to a member when added to an OSFGroup
GROUP_MEMBER_ADDED_EMAIL_THROTTLE = 24 * 3600
# Seconds before another notification email can be sent to group members when added to a project
GROUP_CONNECTED_EMAIL_THROTTLE = 24 * 3600
# Google Analytics
GOOGLE_ANALYTICS_ID = None
GOOGLE_SITE_VERIFICATION = None
DEFAULT_HMAC_SECRET = 'changeme'
DEFAULT_HMAC_ALGORITHM = hashlib.sha256
WATERBUTLER_URL = 'http://localhost:7777'
WATERBUTLER_INTERNAL_URL = WATERBUTLER_URL
####################
# Identifiers #
###################
PID_VALIDATION_ENABLED = False
PID_VALIDATION_ENDPOINTS = {
'doi': 'https://doi.org/ra/'
}
DOI_URL_PREFIX = 'https://doi.org/'
# General Format for DOIs
DOI_FORMAT = '{prefix}/osf.io/{guid}'
# datacite
DATACITE_ENABLED = True
DATACITE_USERNAME = None
DATACITE_PASSWORD = None
DATACITE_URL = 'https://mds.datacite.org'
DATACITE_PREFIX = '10.70102' # Datacite's test DOI prefix -- update in production
# crossref
CROSSREF_USERNAME = None
CROSSREF_PASSWORD = None
CROSSREF_URL = None # Location to POST crossref data. In production, change this to the production CrossRef API endpoint
CROSSREF_DEPOSITOR_EMAIL = 'None' # This email will receive confirmation/error messages from CrossRef on submission
ECSARXIV_CROSSREF_USERNAME = None
ECSARXIV_CROSSREF_PASSWORD = None
# ror
OSF_ROR_ID = '05d5mza29'
OSF_GRID_ID = 'grid.466501.0'
# if our DOIs cannot be confirmed after X amount of days email the admin
DAYS_CROSSREF_DOIS_MUST_BE_STUCK_BEFORE_EMAIL = 2
# Crossref has a second metadata api that uses JSON with different features
CROSSREF_JSON_API_URL = 'https://api.crossref.org/'
# Leave as `None` for production, test/staging/local envs must set
SHARE_PROVIDER_PREPEND = None
SHARE_ENABLED = True # This should be False for most local development
SHARE_REGISTRATION_URL = ''
SHARE_URL = 'https://share.osf.io/'
SHARE_API_TOKEN = None # Required to send project updates to SHARE
CAS_SERVER_URL = 'http://localhost:8080'
MFR_SERVER_URL = 'http://localhost:7778'
###### ARCHIVER ###########
ARCHIVE_PROVIDER = 'osfstorage'
MAX_ARCHIVE_SIZE = 5 * 1024 ** 3 # == math.pow(1024, 3) == 1 GB
ARCHIVE_TIMEOUT_TIMEDELTA = timedelta(1) # 24 hours
STUCK_FILES_DELETE_TIMEOUT = timedelta(days=45) # Registration files stuck for x days are marked as deleted.
ENABLE_ARCHIVER = True
JWT_SECRET = 'changeme'
JWT_ALGORITHM = 'HS256'
##### CELERY #####
# Default RabbitMQ broker
RABBITMQ_USERNAME = os.environ.get('RABBITMQ_USERNAME', 'guest')
RABBITMQ_PASSWORD = os.environ.get('RABBITMQ_PASSWORD', 'guest')
RABBITMQ_HOST = os.environ.get('RABBITMQ_HOST', 'localhost')
RABBITMQ_PORT = os.environ.get('RABBITMQ_PORT', '5672')
RABBITMQ_VHOST = os.environ.get('RABBITMQ_VHOST', '/')
# Seconds, not an actual celery setting
CELERY_RETRY_BACKOFF_BASE = 5
class CeleryConfig:
"""
Celery Configuration
http://docs.celeryproject.org/en/latest/userguide/configuration.html
"""
timezone = 'UTC'
task_default_queue = 'celery'
task_low_queue = 'low'
task_med_queue = 'med'
task_high_queue = 'high'
low_pri_modules = {
'framework.analytics.tasks',
'framework.celery_tasks',
'scripts.osfstorage.usage_audit',
'scripts.stuck_registration_audit',
'scripts.populate_new_and_noteworthy_projects',
'scripts.populate_popular_projects_and_registrations',
'website.search.elastic_search',
'scripts.generate_sitemap',
'scripts.clear_sessions',
'osf.management.commands.delete_withdrawn_or_failed_registration_files',
'osf.management.commands.check_crossref_dois',
'osf.management.commands.find_spammy_files',
'osf.management.commands.migrate_pagecounter_data',
'osf.management.commands.migrate_deleted_date',
'osf.management.commands.addon_deleted_date',
'osf.management.commands.migrate_registration_responses',
'osf.management.commands.archive_registrations_on_IA'
'osf.management.commands.sync_doi_metadata',
'osf.management.commands.sync_collection_provider_indices',
'osf.management.commands.sync_datacite_doi_metadata',
'osf.management.commands.update_institution_project_counts',
'osf.management.commands.populate_branched_from',
'osf.management.commands.cumulative_plos_metrics',
'osf.management.commands.daily_reporters_go',
'osf.management.commands.monthly_reporters_go',
}
med_pri_modules = {
'framework.email.tasks',
'scripts.send_queued_mails',
'scripts.triggered_mails',
'website.mailchimp_utils',
'website.notifications.tasks',
'website.collections.tasks',
'website.identifier.tasks',
'website.preprints.tasks',
'website.project.tasks',
}
high_pri_modules = {
'scripts.approve_embargo_terminations',
'scripts.approve_registrations',
'scripts.embargo_registrations',
'scripts.premigrate_created_modified',
'scripts.refresh_addon_tokens',
'scripts.retract_registrations',
'website.archiver.tasks',
'scripts.add_missing_identifiers_to_preprints',
'osf.management.commands.approve_pending_schema_response',
'osf.management.commands.fix_quickfiles_waterbutler_logs'
}
try:
from kombu import Queue, Exchange
except ImportError:
pass
else:
task_queues = (
Queue(task_low_queue, Exchange(task_low_queue), routing_key=task_low_queue,
consumer_arguments={'x-priority': -1}),
Queue(task_default_queue, Exchange(task_default_queue), routing_key=task_default_queue,
consumer_arguments={'x-priority': 0}),
Queue(task_med_queue, Exchange(task_med_queue), routing_key=task_med_queue,
consumer_arguments={'x-priority': 1}),
Queue(task_high_queue, Exchange(task_high_queue), routing_key=task_high_queue,
consumer_arguments={'x-priority': 10}),
)
task_default_exchange_type = 'direct'
task_routes = ('framework.celery_tasks.routers.CeleryRouter', )
task_ignore_result = True
task_store_errors_even_if_ignored = True
broker_url = os.environ.get('BROKER_URL', 'amqp://{}:{}@{}:{}/{}'.format(RABBITMQ_USERNAME, RABBITMQ_PASSWORD, RABBITMQ_HOST, RABBITMQ_PORT, RABBITMQ_VHOST))
broker_use_ssl = False
# Default RabbitMQ backend
result_backend = 'django-db' # django-celery-results
beat_scheduler = 'django_celery_beat.schedulers:DatabaseScheduler'
# Modules to import when celery launches
imports = (
'framework.celery_tasks',
'framework.email.tasks',
'osf.external.chronos.tasks',
'osf.management.commands.data_storage_usage',
'osf.management.commands.registration_schema_metrics',
'website.mailchimp_utils',
'website.notifications.tasks',
'website.archiver.tasks',
'website.search.search',
'website.project.tasks',
'scripts.populate_new_and_noteworthy_projects',
'scripts.populate_popular_projects_and_registrations',
'scripts.refresh_addon_tokens',
'scripts.retract_registrations',
'scripts.embargo_registrations',
'scripts.approve_registrations',
'scripts.approve_embargo_terminations',
'scripts.triggered_mails',
'scripts.clear_sessions',
'scripts.send_queued_mails',
'scripts.generate_sitemap',
'scripts.premigrate_created_modified',
'scripts.add_missing_identifiers_to_preprints',
'osf.management.commands.deactivate_requested_accounts',
'osf.management.commands.check_crossref_dois',
'osf.management.commands.find_spammy_files',
'osf.management.commands.update_institution_project_counts',
'osf.management.commands.correct_registration_moderation_states',
'osf.management.commands.sync_collection_provider_indices',
'osf.management.commands.sync_datacite_doi_metadata',
'osf.management.commands.archive_registrations_on_IA',
'osf.management.commands.populate_initial_schema_responses',
'osf.management.commands.approve_pending_schema_responses',
'osf.management.commands.delete_legacy_quickfiles_nodes',
'osf.management.commands.fix_quickfiles_waterbutler_logs',
'osf.management.commands.sync_doi_metadata',
'osf.management.commands.cumulative_plos_metrics',
'api.providers.tasks',
'osf.management.commands.daily_reporters_go',
'osf.management.commands.monthly_reporters_go',
)
# Modules that need metrics and release requirements
# imports += (
# 'scripts.osfstorage.usage_audit',
# 'scripts.stuck_registration_audit',
# 'scripts.analytics.tasks',
# 'scripts.analytics.upload',
# )
# celery.schedule will not be installed when running invoke requirements the first time.
try:
from celery.schedules import crontab
except ImportError:
pass
else:
# Setting up a scheduler, essentially replaces an independent cron job
# Note: these times must be in UTC
beat_schedule = {
'5-minute-emails': {
'task': 'website.notifications.tasks.send_users_email',
'schedule': crontab(minute='*/5'),
'args': ('email_transactional',),
},
'daily-emails': {
'task': 'website.notifications.tasks.send_users_email',
'schedule': crontab(minute=0, hour=5), # Daily at 12 a.m. EST
'args': ('email_digest',),
},
'refresh_addons': {
'task': 'scripts.refresh_addon_tokens',
'schedule': crontab(minute=0, hour=7), # Daily 2:00 a.m
'kwargs': {'dry_run': False, 'addons': {
'box': 60, # https://docs.box.com/docs/oauth-20#section-6-using-the-access-and-refresh-tokens
'googledrive': 14, # https://developers.google.com/identity/protocols/OAuth2#expiration
'mendeley': 14 # http://dev.mendeley.com/reference/topics/authorization_overview.html
}},
},
'retract_registrations': {
'task': 'scripts.retract_registrations',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'embargo_registrations': {
'task': 'scripts.embargo_registrations',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'add_missing_identifiers_to_preprints': {
'task': 'scripts.add_missing_identifiers_to_preprints',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'approve_registrations': {
'task': 'scripts.approve_registrations',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'approve_embargo_terminations': {
'task': 'scripts.approve_embargo_terminations',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'triggered_mails': {
'task': 'scripts.triggered_mails',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'clear_sessions': {
'task': 'scripts.clear_sessions',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'send_queued_mails': {
'task': 'scripts.send_queued_mails',
'schedule': crontab(minute=0, hour=17), # Daily 12 p.m.
'kwargs': {'dry_run': False},
},
'new-and-noteworthy': {
'task': 'scripts.populate_new_and_noteworthy_projects',
'schedule': crontab(minute=0, hour=7, day_of_week=6), # Saturday 2:00 a.m.
'kwargs': {'dry_run': False}
},
'update_popular_nodes': {
'task': 'scripts.populate_popular_projects_and_registrations',
'schedule': crontab(minute=0, hour=7), # Daily 2:00 a.m.
'kwargs': {'dry_run': False}
},
'registration_schema_metrics': {
'task': 'management.commands.registration_schema_metrics',
'schedule': crontab(minute=45, hour=7, day_of_month=3), # Third day of month 2:45 a.m.
'kwargs': {'dry_run': False}
},
'daily_reporters_go': {
'task': 'management.commands.daily_reporters_go',
'schedule': crontab(minute=0, hour=6), # Daily 1:00 a.m.
'kwargs': {'also_send_to_keen': True},
},
'monthly_reporters_go': {
'task': 'management.commands.monthly_reporters_go',
'schedule': crontab(minute=30, hour=6, day_of_month=2), # Second day of month 1:30 a.m.
},
# 'data_storage_usage': {
# 'task': 'management.commands.data_storage_usage',
# 'schedule': crontab(day_of_month=1, minute=30, hour=4), # Last of the month at 11:30 p.m.
# },
# 'migrate_pagecounter_data': {
# 'task': 'management.commands.migrate_pagecounter_data',
# 'schedule': crontab(minute=0, hour=7), # Daily 2:00 a.m.
# },
# 'migrate_registration_responses': {
# 'task': 'management.commands.migrate_registration_responses',
# 'schedule': crontab(minute=32, hour=7), # Daily 2:32 a.m.
# 'migrate_deleted_date': {
# 'task': 'management.commands.migrate_deleted_date',
# 'schedule': crontab(minute=0, hour=3),
# 'addon_deleted_date': {
# 'task': 'management.commands.addon_deleted_date',
# 'schedule': crontab(minute=0, hour=3), # Daily 11:00 p.m.
# },
# 'populate_branched_from': {
# 'task': 'management.commands.populate_branched_from',
# 'schedule': crontab(minute=0, hour=3),
# },
'generate_sitemap': {
'task': 'scripts.generate_sitemap',
'schedule': crontab(minute=0, hour=5), # Daily 12:00 a.m.
},
'deactivate_requested_accounts': {
'task': 'management.commands.deactivate_requested_accounts',
'schedule': crontab(minute=0, hour=5), # Daily 12:00 a.m.
},
'check_crossref_doi': {
'task': 'management.commands.check_crossref_dois',
'schedule': crontab(minute=0, hour=4), # Daily 11:00 p.m.
},
'update_institution_project_counts': {
'task': 'management.commands.update_institution_project_counts',
'schedule': crontab(minute=0, hour=9), # Daily 05:00 a.m. EDT
},
# 'archive_registrations_on_IA': {
# 'task': 'osf.management.commands.archive_registrations_on_IA',
# 'schedule': crontab(minute=0, hour=5), # Daily 4:00 a.m.
# 'kwargs': {'dry_run': False}
# },
'delete_withdrawn_or_failed_registration_files': {
'task': 'management.commands.delete_withdrawn_or_failed_registration_files',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {
'dry_run': False,
'batch_size_withdrawn': 10,
'batch_size_stuck': 10
}
},
'monitor_registration_bulk_upload_jobs': {
'task': 'api.providers.tasks.monitor_registration_bulk_upload_jobs',
# 'schedule': crontab(hour='*/3'), # Every 3 hours
'schedule': crontab(minute='*/5'), # Every 5 minutes for staging server QA test
'kwargs': {'dry_run': False}
},
'approve_registration_updates': {
'task': 'osf.management.commands.approve_pending_schema_responses',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False},
},
'delete_legacy_quickfiles_nodes': {
'task': 'osf.management.commands.delete_legacy_quickfiles_nodes',
'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
'kwargs': {'dry_run': False, 'batch_size': 10000},
},
}
# Tasks that need metrics and release requirements
# beat_schedule.update({
# 'usage_audit': {
# 'task': 'scripts.osfstorage.usage_audit',
# 'schedule': crontab(minute=0, hour=5), # Daily 12 a.m
# 'kwargs': {'send_mail': True},
# },
# 'stuck_registration_audit': {
# 'task': 'scripts.stuck_registration_audit',
# 'schedule': crontab(minute=0, hour=11), # Daily 6 a.m
# 'kwargs': {},
# },
# 'cumulative_plos_metrics': {
# 'task': 'osf.management.commands.cumulative_plos_metrics',
# 'schedule': crontab(day_of_month=1, minute=30, hour=9), # First of the month at 4:30 a.m.
# 'kwargs': {},
# },
# })
WATERBUTLER_JWE_SALT = 'yusaltydough'
WATERBUTLER_JWE_SECRET = 'CirclesAre4Squares'
WATERBUTLER_JWT_SECRET = 'ILiekTrianglesALot'
WATERBUTLER_JWT_ALGORITHM = 'HS256'
WATERBUTLER_JWT_EXPIRATION = 15
SENSITIVE_DATA_SALT = 'yusaltydough'
SENSITIVE_DATA_SECRET = 'TrainglesAre5Squares'
DRAFT_REGISTRATION_APPROVAL_PERIOD = datetime.timedelta(days=10)
assert (DRAFT_REGISTRATION_APPROVAL_PERIOD > EMBARGO_END_DATE_MIN), 'The draft registration approval period should be more than the minimum embargo end date.'
# TODO: Remove references to this flag
ENABLE_INSTITUTIONS = True
ENABLE_STORAGE_USAGE_CACHE = True
ENABLE_VARNISH = False
ENABLE_ESI = False
VARNISH_SERVERS = [] # This should be set in local.py or cache invalidation won't work
ESI_MEDIA_TYPES = {'application/vnd.api+json', 'application/json'}
# Used for gathering meta information about the current build
GITHUB_API_TOKEN = None
# switch for disabling things that shouldn't happen during
# the modm to django migration
RUNNING_MIGRATION = False
# External Identity Provider
EXTERNAL_IDENTITY_PROFILE = {
'OrcidProfile': 'ORCID',
}
ORCID_PUBLIC_API_ACCESS_TOKEN = None
ORCID_PUBLIC_API_V3_URL = 'https://pub.orcid.org/v3.0/'
ORCID_PUBLIC_API_REQUEST_TIMEOUT = None
ORCID_RECORD_ACCEPT_TYPE = 'application/vnd.orcid+xml'
ORCID_RECORD_EMPLOYMENT_PATH = '/employments'
ORCID_RECORD_EDUCATION_PATH = '/educations'
# Source: https://github.com/maxd/fake_email_validator/blob/master/config/fake_domains.list
BLACKLISTED_DOMAINS = [
'0-mail.com',
'0815.ru',
'0815.su',
'0clickemail.com',
'0wnd.net',
'0wnd.org',
'10mail.org',
'10minut.com.pl',
'10minutemail.cf',
'10minutemail.co.uk',
'10minutemail.co.za',
'10minutemail.com',
'10minutemail.de',
'10minutemail.eu',
'10minutemail.ga',
'10minutemail.gq',
'10minutemail.info',
'10minutemail.ml',
'10minutemail.net',
'10minutemail.org',
'10minutemail.ru',
'10minutemail.us',
'10minutesmail.co.uk',
'10minutesmail.com',
'10minutesmail.eu',
'10minutesmail.net',
'10minutesmail.org',
'10minutesmail.ru',
'10minutesmail.us',
'123-m.com',
'15qm-mail.red',
'15qm.com',
'1chuan.com',
'1mail.ml',
'1pad.de',
'1usemail.com',
'1zhuan.com',
'20mail.in',
'20mail.it',
'20minutemail.com',
'2prong.com',
'30minutemail.com',
'30minutesmail.com',
'33mail.com',
'3d-painting.com',
'3mail.ga',
'4mail.cf',
'4mail.ga',
'4warding.com',
'4warding.net',
'4warding.org',
'5mail.cf',
'5mail.ga',
'60minutemail.com',
'675hosting.com',
'675hosting.net',
'675hosting.org',
'6ip.us',
'6mail.cf',
'6mail.ga',
'6mail.ml',
'6paq.com',
'6url.com',
'75hosting.com',
'75hosting.net',
'75hosting.org',
'7mail.ga',
'7mail.ml',
'7mail7.com',
'7tags.com',
'8mail.cf',
'8mail.ga',
'8mail.ml',
'99experts.com',
'9mail.cf',
'9ox.net',
'a-bc.net',
'a45.in',
'abcmail.email',
'abusemail.de',
'abyssmail.com',
'acentri.com',
'advantimo.com',
'afrobacon.com',
'agedmail.com',
'ajaxapp.net',
'alivance.com',
'ama-trade.de',
'amail.com',
'amail4.me',
'amilegit.com',
'amiri.net',
'amiriindustries.com',
'anappthat.com',
'ano-mail.net',
'anobox.ru',
'anonbox.net',
'anonmails.de',
'anonymail.dk',
'anonymbox.com',
'antichef.com',
'antichef.net',
'antireg.ru',
'antispam.de',
'antispammail.de',
'appixie.com',
'armyspy.com',
'artman-conception.com',
'asdasd.ru',
'azmeil.tk',
'baxomale.ht.cx',
'beddly.com',
'beefmilk.com',
'beerolympics.se',
'bestemailaddress.net',
'bigprofessor.so',
'bigstring.com',
'binkmail.com',
'bio-muesli.net',
'biojuris.com',
'biyac.com',
'bladesmail.net',
'bloatbox.com',
'bobmail.info',
'bodhi.lawlita.com',
'bofthew.com',
'bootybay.de',
'bossmail.de',
'boun.cr',
'bouncr.com',
'boxformail.in',
'boximail.com',
'boxtemp.com.br',
'breakthru.com',
'brefmail.com',
'brennendesreich.de',
'broadbandninja.com',
'bsnow.net',
'bspamfree.org',
'buffemail.com',
'bugmenot.com',
'bumpymail.com',
'bund.us',
'bundes-li.ga',
'burnthespam.info',
'burstmail.info',
'buymoreplays.com',
'buyusedlibrarybooks.org',
'byom.de',
'c2.hu',
'cachedot.net',
'card.zp.ua',
'casualdx.com',
'cbair.com',
'cdnqa.com',
'cek.pm',
'cellurl.com',
'cem.net',
'centermail.com',
'centermail.net',
'chammy.info',
'cheatmail.de',
'chewiemail.com',
'childsavetrust.org',
'chogmail.com',
'choicemail1.com',
'chong-mail.com',
'chong-mail.net',
'chong-mail.org',
'clixser.com',
'clrmail.com',
'cmail.net',
'cmail.org',
'coldemail.info',
'consumerriot.com',
'cool.fr.nf',
'correo.blogos.net',
'cosmorph.com',
'courriel.fr.nf',
'courrieltemporaire.com',
'crapmail.org',
'crazymailing.com',
'cubiclink.com',
'curryworld.de',
'cust.in',
'cuvox.de',
'd3p.dk',
'dacoolest.com',
'daintly.com',
'dandikmail.com',
'dayrep.com',
'dbunker.com',
'dcemail.com',
'deadaddress.com',
'deadfake.cf',
'deadfake.ga',
'deadfake.ml',
'deadfake.tk',
'deadspam.com',
'deagot.com',
'dealja.com',
'delikkt.de',
'despam.it',
'despammed.com',
'devnullmail.com',
'dfgh.net',
'digitalsanctuary.com',
'dingbone.com',
'dingfone.com',
'discard.cf',
'discard.email',
'discard.ga',
'discard.gq',
'discard.ml',
'discard.tk',
'discardmail.com',
'discardmail.de',
'dispomail.eu',
'disposable-email.ml',
'disposable.cf',
'disposable.ga',
'disposable.ml',
'disposableaddress.com',
'disposableemailaddresses.com',
'disposableinbox.com',
'dispose.it',
'disposeamail.com',
'disposemail.com',
'dispostable.com',
'divermail.com',
'dodgeit.com',
'dodgemail.de',
'dodgit.com',