Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 469d0997

History | View | Annotate | Download (14.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
# OAuth2 Twitter credentials.
8
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
9
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
10
TWITTER_AUTH_FORCE_LOGIN = getattr(settings, 'ASTAKOS_TWITTER_AUTH_FORCE_LOGIN',
11
                                  False)
12

    
13

    
14
# OAuth2 Google credentials.
15
GOOGLE_CLIENT_ID = getattr(settings, 'ASTAKOS_GOOGLE_CLIENT_ID', '')
16
GOOGLE_SECRET = getattr(settings, 'ASTAKOS_GOOGLE_SECRET', '')
17

    
18
# OAuth2 LinkedIn credentials.
19
LINKEDIN_TOKEN = getattr(settings, 'ASTAKOS_LINKEDIN_TOKEN', '')
20
LINKEDIN_SECRET = getattr(settings, 'ASTAKOS_LINKEDIN_SECRET', '')
21

    
22
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
23

    
24
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
25
    0: 100,
26
    1: 2,
27
    2: 0,
28
    3: 0,
29
    4: 0
30
})
31

    
32
# Address to use for outgoing emails
33
DEFAULT_CONTACT_EMAIL = getattr(
34
    settings, 'ASTAKOS_DEFAULT_CONTACT_EMAIL', 'support@cloud.grnet.gr')
35

    
36
SERVER_EMAIL = getattr(settings, 'SERVER_EMAIL', None)
37
ADMINS = getattr(settings, 'ADMINS', None)
38

    
39
# Identity Management enabled modules
40
# Supported modules are: 'local', 'twitter' and 'shibboleth'
41
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
42

    
43
# Force user profile verification
44
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', True)
45

    
46
#Enable invitations
47
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
48

    
49
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
50
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
51
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
52

    
53
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
54

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

    
58
# Set baseurl
59
BASEURL = getattr(settings, 'ASTAKOS_BASEURL', 'http://pithos.dev.grnet.gr')
60

    
61
# Set service name
62
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', 'GRNET Cloud')
63

    
64
# Set recaptcha keys
65
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
66
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
67
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
68
                            {'theme': 'custom', 'custom_theme_widget': 'okeanos_recaptcha'})
69
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
70
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
71

    
72
# set AstakosUser fields to propagate in the billing system
73
BILLING_FIELDS = getattr(settings, 'ASTAKOS_BILLING_FIELDS', ['is_active'])
74

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

    
78
# Set where the user should be redirected after logout
79
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
80

    
81
# Set user email patterns that are automatically activated
82
RE_USER_EMAIL_PATTERNS = getattr(
83
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
84

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

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

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

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

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

    
105
# The number of unsuccessful login requests per minute allowed for a specific user
106
RATELIMIT_RETRIES_ALLOWED = getattr(
107
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
108

    
109
# If False the email change mechanism is disabled
110
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
111

    
112
# Set the expiration time (in days) of email change requests
113
EMAILCHANGE_ACTIVATION_DAYS = getattr(
114
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
115

    
116
# Set the astakos main functions logging severity (None to disable)
117
from logging import INFO
118
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
119

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

    
174
# Set the quota holder component URI
175
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
176
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
177

    
178
# Set the cloud service properties
179
SERVICES = getattr(settings, 'ASTAKOS_SERVICES', {
180
    'cyclades': {
181
        'url': 'https://node1.example.com/ui/',
182
        'resources': [{
183
            'name':'disk',
184
            'group':'compute',
185
            'uplimit':30*1024*1024*1024,
186
            'unit':'bytes',
187
            'desc': 'Virtual machine disk size'
188
            },{
189
            'name':'cpu',
190
            'group':'compute',
191
            'uplimit':6,
192
            'desc': 'Number of virtual machine processors'
193
            },{
194
            'name':'ram',
195
            'group':'compute',
196
            'uplimit':6*1024*1024*1024,
197
            'unit':'bytes',
198
            'desc': 'Virtual machines'
199
            },{
200
            'name':'vm',
201
            'group':'compute',
202
            'uplimit':2,
203
            'desc': 'Number of virtual machines'
204
            },{
205
            'name':'network.private',
206
            'group':'network',
207
            'uplimit':1,
208
            'desc': 'Private networks'
209
            }
210
        ]
211
    },
212
    'pithos+': {
213
        'url': 'https://node2.example.com/ui/',
214
        'resources':[{
215
            'name':'diskspace',
216
            'group':'storage',
217
            'uplimit':5 * 1024 * 1024 * 1024,
218
            'unit':'bytes',
219
            'desc': 'Pithos account diskspace'
220
            }]
221
    }
222
})
223

    
224
# Set the billing URI
225
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')
226

    
227
# Set how many objects should be displayed per page
228
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
229

    
230
# Set how many objects should be displayed per page in show all groups page
231
PAGINATE_BY_ALL = getattr(settings, 'ASTAKOS_PAGINATE_BY_ALL', 15)
232

    
233
# Enforce token renewal on password change/reset
234
NEWPASSWD_INVALIDATE_TOKEN = getattr(
235
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
236

    
237
USAGE_UPDATE_INTERVAL = getattr(settings, 'ASTAKOS_USAGE_UPDATE_INTERVAL', 5000)
238

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

    
311
        },
312

    
313
        'groups_order': ['storage', 'compute', 'network'],
314
        'resources_order': ['pithos+.diskspace', 'cyclades.disk',
315
                            'cyclades.cpu', 'cyclades.ram', 'cyclades.vm',
316
                            'cyclades.network.private']
317

    
318
    })
319

    
320
# Permit local account migration
321
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
322

    
323
# Strict shibboleth usage
324
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
325
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
326
                                       False)
327

    
328
PROJECT_MEMBER_JOIN_POLICIES = getattr(settings,
329
                                'ASTAKOS_PROJECT_MEMBER_JOIN_POLICIES',
330
                                {'1':'automatically accepted',
331
                                 '2':'owner accepts',
332
                                 '3':'closed'})
333

    
334
PROJECT_MEMBER_LEAVE_POLICIES = getattr(settings,
335
                                'ASTAKOS_PROJECT_MEMBER_LEAVE_POLICIES',
336
                                {'1':'automatically accepted',
337
                                 '2':'owner accepts',
338
                                 '3':'closed'})
339

    
340
ACTIVATION_REDIRECT_URL = getattr(settings,
341
                                  'ASTAKOS_ACTIVATION_REDIRECT_URL',
342
                                  "/im/landing")
343

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

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