Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 9d889386

History | View | Annotate | Download (15.6 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://www.myhomepage.com': 'Back to <service_name>'}
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

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

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

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

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

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

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

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

    
303
        },
304

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

    
310
    })
311

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

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

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

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

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

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

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

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

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

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

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

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