Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ ee6a65bd

History | View | Annotate | Download (15.8 kB)

1
from django.conf import settings
2

    
3
# Set the expiration time of newly created auth tokens
4
# to be this many hours after their creation time.
5
AUTH_TOKEN_DURATION = getattr(settings, 'ASTAKOS_AUTH_TOKEN_DURATION', 30 * 24)
6

    
7
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
8

    
9
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
10
    0: 100,
11
    1: 2,
12
    2: 0,
13
    3: 0,
14
    4: 0
15
})
16

    
17
# Address to use for outgoing emails
18
DEFAULT_CONTACT_EMAIL = getattr(
19
    settings, 'ASTAKOS_DEFAULT_CONTACT_EMAIL', 'support@example.synnefo.org')
20

    
21
SERVER_EMAIL = getattr(settings, 'SERVER_EMAIL', None)
22
ADMINS = getattr(settings, 'ADMINS', None)
23

    
24
# Identity Management enabled modules
25
# Supported modules are: 'local', 'twitter' and 'shibboleth'
26
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
27

    
28
# Force user profile verification
29
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', True)
30

    
31
#Enable invitations
32
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
33

    
34
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
35
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
36
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
37

    
38
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
39

    
40
# If set to False and invitations not enabled newly created user will be automatically accepted
41
MODERATION_ENABLED = getattr(settings, 'ASTAKOS_MODERATION_ENABLED', True)
42

    
43
# Set baseurl
44
BASEURL = getattr(settings, 'ASTAKOS_BASEURL', 'https://accounts.example.synnefo.org')
45

    
46
# Set service name
47
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', 'Synnefo Cloud')
48

    
49
# Set recaptcha keys
50
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
51
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
52
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
53
                            {'theme': 'custom', 'custom_theme_widget': 'okeanos_recaptcha'})
54
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
55
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
56

    
57
# set AstakosUser fields to propagate in the billing system
58
BILLING_FIELDS = getattr(settings, 'ASTAKOS_BILLING_FIELDS', ['is_active'])
59

    
60
# Queue for billing.
61
QUEUE_CONNECTION = getattr(settings, 'ASTAKOS_QUEUE_CONNECTION', None)  # Example: 'rabbitmq://guest:guest@localhost:5672/astakos'
62

    
63
# Set where the user should be redirected after logout
64
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
65

    
66
# Set user email patterns that are automatically activated
67
RE_USER_EMAIL_PATTERNS = getattr(
68
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
69

    
70
# Messages to display on login page header
71
# e.g. {'warning': 'This warning message will be displayed on the top of login page'}
72
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', [])
73

    
74
# Messages to display on login page header
75
# e.g. {'warning': 'This warning message will be displayed on the top of signup page'}
76
SIGNUP_MESSAGES = getattr(settings, 'ASTAKOS_SIGNUP_MESSAGES', [])
77

    
78
# Messages to display on login page header
79
# e.g. {'warning': 'This warning message will be displayed on the top of profile page'}
80
PROFILE_MESSAGES = getattr(settings, 'ASTAKOS_PROFILE_MESSAGES', [])
81

    
82
# Messages to display on all pages
83
# e.g. {'warning': 'This warning message will be displayed on the top of every page'}
84
GLOBAL_MESSAGES = getattr(settings, 'ASTAKOS_GLOBAL_MESSAGES', [])
85

    
86
# messages to display as extra actions in account forms
87
# e.g. {'https://cms.okeanos.grnet.gr/': 'Back to ~okeanos'}
88
PROFILE_EXTRA_LINKS = getattr(settings, 'ASTAKOS_PROFILE_EXTRA_LINKS', {})
89

    
90
# The number of unsuccessful login requests per minute allowed for a specific user
91
RATELIMIT_RETRIES_ALLOWED = getattr(
92
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
93

    
94
# If False the email change mechanism is disabled
95
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
96

    
97
# Set the expiration time (in days) of email change requests
98
EMAILCHANGE_ACTIVATION_DAYS = getattr(
99
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
100

    
101
# Set the astakos main functions logging severity (None to disable)
102
from logging import INFO
103
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
104

    
105
# Configurable email subjects
106
INVITATION_EMAIL_SUBJECT = getattr(
107
    settings, 'ASTAKOS_INVITATION_EMAIL_SUBJECT',
108
    'Invitation to %s alpha2 testing' % SITENAME)
109
GREETING_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_GREETING_EMAIL_SUBJECT',
110
                                 'Welcome to %s alpha2 testing' % SITENAME)
111
FEEDBACK_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_FEEDBACK_EMAIL_SUBJECT',
112
                                 'Feedback from %s alpha2 testing' % SITENAME)
113
VERIFICATION_EMAIL_SUBJECT = getattr(
114
    settings, 'ASTAKOS_VERIFICATION_EMAIL_SUBJECT',
115
    '%s alpha2 testing account activation is needed' % SITENAME)
116
ACCOUNT_CREATION_SUBJECT = getattr(
117
    settings, 'ASTAKOS_ACCOUNT_CREATION_SUBJECT',
118
    '%s alpha2 testing account created (%%(user)s)' % SITENAME)
119
GROUP_CREATION_SUBJECT = getattr(
120
    settings, 'ASTAKOS_GROUP_CREATION_SUBJECT',
121
    '%s alpha2 testing group created (%%(group)s)' % SITENAME)
122
HELPDESK_NOTIFICATION_EMAIL_SUBJECT = getattr(
123
    settings, 'ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT',
124
    '%s alpha2 testing account activated (%%(user)s)' % SITENAME)
125
EMAIL_CHANGE_EMAIL_SUBJECT = getattr(
126
    settings, 'ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT',
127
    'Email change on %s alpha2 testing' % SITENAME)
128
PASSWORD_RESET_EMAIL_SUBJECT = getattr(
129
    settings, 'ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT',
130
    'Password reset on %s alpha2 testing' % SITENAME)
131
PROJECT_CREATION_SUBJECT = getattr(
132
    settings, 'ASTAKOS_PROJECT_CREATION_SUBJECT',
133
    '%s alpha2 testing project application created (%%(name)s)' % SITENAME)
134
PROJECT_APPROVED_SUBJECT = getattr(
135
    settings, 'ASTAKOS_PROJECT_APPROVED_SUBJECT',
136
    '%s alpha2 testing project application approved (%%(name)s)' % SITENAME)
137
PROJECT_DENIED_SUBJECT = getattr(
138
    settings, 'ASTAKOS_PROJECT_DENIED_SUBJECT',
139
    '%s alpha2 testing project application denied (%%(name)s)' % SITENAME)
140
PROJECT_TERMINATION_SUBJECT = getattr(
141
    settings, 'ASTAKOS_PROJECT_TERMINATION_SUBJECT',
142
    '%s alpha2 testing project terminated (%%(name)s)' % SITENAME)
143
PROJECT_SUSPENSION_SUBJECT = getattr(
144
    settings, 'ASTAKOS_PROJECT_SUSPENSION_SUBJECT',
145
    '%s alpha2 testing project suspended (%%(name)s)' % SITENAME)
146
PROJECT_MEMBERSHIP_CHANGE_SUBJECT = getattr(
147
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_CHANGE_SUBJECT',
148
    '%s alpha2 testing project membership changed (%%(name)s)' % SITENAME)
149
PROJECT_MEMBERSHIP_ENROLL_SUBJECT = getattr(
150
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_ENROLL_SUBJECT',
151
    '%s alpha2 testing project enrollment (%%(name)s)' % SITENAME)
152
PROJECT_MEMBERSHIP_REQUEST_SUBJECT = getattr(
153
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_REQUEST_SUBJECT',
154
    '%s alpha2 testing project membership request (%%(name)s)' % SITENAME)
155
PROJECT_MEMBERSHIP_LEAVE_REQUEST_SUBJECT = getattr(
156
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_LEAVE_REQUEST_SUBJECT',
157
    '%s alpha2 testing project membership leave request (%%(name)s)' % SITENAME)
158

    
159
# Set the quota holder component URI
160
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
161
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
162
QUOTAHOLDER_POOLSIZE = getattr(settings, 'ASTAKOS_QUOTAHOLDER_POOLSIZE', 50)
163

    
164
# Set the cloud service properties
165
SERVICES = getattr(settings, 'ASTAKOS_SERVICES', {
166
    'cyclades': {
167
#        # Specifying the key 'url' will overwrite it.
168
#        # Use this to (re)set service URL.
169
#        'url': 'https://cyclades.example.synnefo.org/ui/',
170
#        # order services in listings, cloudbar, etc.
171
#        'order' : 1
172
        'resources': [{
173
            'name': 'disk',
174
            'group': 'compute',
175
            'uplimit': 30*1024*1024*1024,
176
            'unit': 'bytes',
177
            'desc': 'Virtual machine disk size'
178
            }, {
179
            'name': 'cpu',
180
            'group': 'compute',
181
            'uplimit': 6,
182
            'desc': 'Number of virtual machine processors'
183
            }, {
184
            'name': 'ram',
185
            'group': 'compute',
186
            'uplimit': 6*1024*1024*1024,
187
            'unit': 'bytes',
188
            'desc': 'Virtual machines'
189
            }, {
190
            'name': 'vm',
191
            'group': 'compute',
192
            'uplimit': 2,
193
            'desc': 'Number of virtual machines'
194
            }, {
195
            'name': 'network.private',
196
            'group': 'network',
197
            'uplimit': 1,
198
            'desc': 'Private networks'
199
            }
200
        ]
201
    },
202
    'pithos+': {
203
#        # Use this to (re)set service URL.
204
#        'url': 'https://pithos.example.synnefo.org/ui/',
205
#        # order services in listings, cloudbar, etc.
206
#        'order' : 2
207
        'resources':[{
208
            'name': 'diskspace',
209
            'group': 'storage',
210
            'uplimit': 5*1024*1024*1024,
211
            'unit': 'bytes',
212
            'desc': 'Pithos account diskspace'
213
            }]
214
    }
215
})
216

    
217
# Set the billing URI
218
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')
219

    
220
# Set how many objects should be displayed per page
221
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
222

    
223
# Set how many objects should be displayed per page in show all projects page
224
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 15)
225

    
226
# Enforce token renewal on password change/reset
227
NEWPASSWD_INVALIDATE_TOKEN = getattr(
228
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
229

    
230
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
231

    
232
RESOURCES_PRESENTATION_DATA = getattr(
233
    settings, 'ASTAKOS_RESOURCES_PRESENTATION_DATA', {
234
        'groups': {
235
             'compute': {
236
                'help_text':'Compute resources (amount of VMs, CPUs, RAM, System disk) ',
237
                'is_abbreviation':False,
238
                'report_desc':'',
239
                 'verbose_name':'compute',
240
            },
241
            'storage': {
242
                'help_text':'Storage resources (amount of space to store files on Pithos) ',
243
                'is_abbreviation':False,
244
                'report_desc':'',
245
                 'verbose_name':'storage',
246
            },
247
            'network': {
248
                'help_text':' Network resources (number of Private Networks)  ',
249
                'is_abbreviation':False,
250
                'report_desc':'',
251
                'verbose_name':'network',
252
            },
253
        },
254
        'resources': {
255
            'pithos+.diskspace': {
256
                'help_text':'This is the space on Pithos for storing files and VM Images. ',
257
                'help_text_input_each':'This is the total amount of space on Pithos that will be granted to each user of this Project ',
258
                'is_abbreviation':False,
259
                'report_desc':'Storage Space',
260
                'placeholder':'eg. 10GB',
261
                'verbose_name':'Storage Space',
262
            },
263
            'cyclades.disk': {
264
                'help_text':'This is the System Disk that the VMs have that run the OS ',
265
                'help_text_input_each':"This is the total amount of System Disk that will be granted to each user of this Project (this refers to the total System Disk of all VMs, not each VM's System Disk)  ",
266
                'is_abbreviation':False,
267
                'report_desc':'System Disk',
268
                'placeholder':'eg. 5GB, 2GB etc',
269
                'verbose_name':'System Disk'
270
            },
271
            'cyclades.ram': {
272
                'help_text':'RAM used by VMs ',
273
                'help_text_input_each':'This is the total amount of RAM that will be granted to each user of this Project (on all VMs)  ',
274
                'is_abbreviation':True,
275
                'report_desc':'RAM',
276
                'placeholder':'eg. 4GB',
277
                'verbose_name':'ram'
278
            },
279
            'cyclades.cpu': {
280
                'help_text':'CPUs used by VMs ',
281
                'help_text_input_each':'This is the total number of CPUs that will be granted to each user of this Project (on all VMs)  ',
282
                'is_abbreviation':True,
283
                'report_desc':'CPUs',
284
                'placeholder':'eg. 1',
285
                'verbose_name':'cpu'
286
            },
287
            'cyclades.vm': {
288
                'help_text':'These are the VMs one can create on the Cyclades UI ',
289
                'help_text_input_each':'This is the total number of VMs that will be granted to each user of this Project ',
290
                'is_abbreviation':True,
291
                'report_desc':'Virtual Machines',
292
                'placeholder':'eg. 2',
293
                'verbose_name':'vm',
294
            },
295
            'cyclades.network.private': {
296
                'help_text':'These are the Private Networks one can create on the Cyclades UI. ',
297
                'help_text_input_each':'This is the total number of Private Networks that will be granted to each user of this Project ',
298
                'is_abbreviation':False,
299
                'report_desc':'Private Networks',
300
                'placeholder':'eg. 1',
301
                'verbose_name':'Private Network'
302
            }
303

    
304
        },
305

    
306
        'groups_order': ['storage', 'compute', 'network'],
307
        'resources_order': ['pithos+.diskspace', 'cyclades.disk',
308
                            'cyclades.cpu', 'cyclades.ram', 'cyclades.vm',
309
                            'cyclades.network.private']
310

    
311
    })
312

    
313
# Permit local account migration
314
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
315

    
316
# Strict shibboleth usage
317
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
318
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
319
                                       False)
320

    
321
PROJECT_MEMBER_JOIN_POLICIES = getattr(settings,
322
                                'ASTAKOS_PROJECT_MEMBER_JOIN_POLICIES',
323
                                {'1':'automatically accepted',
324
                                 '2':'owner accepts',
325
                                 '3':'closed'})
326

    
327
PROJECT_MEMBER_LEAVE_POLICIES = getattr(settings,
328
                                'ASTAKOS_PROJECT_MEMBER_LEAVE_POLICIES',
329
                                {'1':'automatically accepted',
330
                                 '2':'owner accepts',
331
                                 '3':'closed'})
332

    
333
ACTIVATION_REDIRECT_URL = getattr(settings,
334
                                  'ASTAKOS_ACTIVATION_REDIRECT_URL',
335
                                  "/im/landing")
336

    
337

    
338
# If true, this enables a ui compatibility layer for the introduction of UUIDs
339
# in identity management. WARNING: Setting to True will break your installation.
340
TRANSLATE_UUIDS = getattr(settings, 'ASTAKOS_TRANSLATE_UUIDS', False)
341

    
342
# Users that can approve or deny project applications from the web.
343
PROJECT_ADMINS = getattr(settings, 'ASTAKOS_PROJECT_ADMINS', set())
344

    
345
# Maximum pending project applications per applicant.
346
# This is to reduce the volume of applications
347
# in case users abuse the mechanism.
348
PENDING_APPLICATION_LIMIT = getattr(settings,
349
                                    'ASTAKOS_PENDING_APPLICATION_LIMIT', 0)
350

    
351
# OAuth2 Twitter credentials.
352
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
353
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
354
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
355
                                  False)
356

    
357
# OAuth2 Google credentials.
358
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
359
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
360

    
361
# OAuth2 LinkedIn credentials.
362
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
363
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
364

    
365
# URL to redirect the user after successful login when no next parameter is set
366
LOGIN_SUCCESS_URL = getattr(settings, 'ASTAKOS_LOGIN_SUCCESS_URL',
367
                            '/im/landing')
368

    
369
# Whether or not to display projects in astakos menu
370
PROJECTS_VISIBLE = getattr(settings, 'ASTAKOS_PROJECTS_VISIBLE', False)