Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 19eb3ee6

History | View | Annotate | Download (13.5 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

    
165
# Set the quota holder component URI
166
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
167
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
168

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

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

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

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

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

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

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

    
302
        }
303

    
304
    })
305

    
306
# Permit local account migration
307
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
308

    
309
# Strict shibboleth usage
310
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
311
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
312
                                       False)
313

    
314
PROJECT_MEMBER_JOIN_POLICIES = getattr(settings,
315
                                'ASTAKOS_PROJECT_MEMBER_JOIN_POLICIES',
316
                                {'1':'automatically accepted',
317
                                 '2':'owner accepts',
318
                                 '3':'closed'})
319

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