Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (12.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
# 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
# Identity Management enabled modules
37
# Supported modules are: 'local', 'twitter' and 'shibboleth'
38
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
39

    
40
# Force user profile verification
41
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', True)
42

    
43
#Enable invitations
44
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
45

    
46
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
47
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
48
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
49

    
50
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
51

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

    
55
# Set baseurl
56
BASEURL = getattr(settings, 'ASTAKOS_BASEURL', 'http://pithos.dev.grnet.gr')
57

    
58
# Set service name
59
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', 'GRNET Cloud')
60

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

    
69
# set AstakosUser fields to propagate in the billing system
70
BILLING_FIELDS = getattr(settings, 'ASTAKOS_BILLING_FIELDS', ['is_active'])
71

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

    
75
# Set where the user should be redirected after logout
76
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
77

    
78
# Set user email patterns that are automatically activated
79
RE_USER_EMAIL_PATTERNS = getattr(
80
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
81

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

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

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

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

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

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

    
106
# If False the email change mechanism is disabled
107
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
108

    
109
# Set the expiration time (in days) of email change requests
110
EMAILCHANGE_ACTIVATION_DAYS = getattr(
111
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
112

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

    
117
# Configurable email subjects
118
INVITATION_EMAIL_SUBJECT = getattr(
119
    settings, 'ASTAKOS_INVITATION_EMAIL_SUBJECT',
120
    'Invitation to %s alpha2 testing' % SITENAME)
121
GREETING_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_GREETING_EMAIL_SUBJECT',
122
                                 'Welcome to %s alpha2 testing' % SITENAME)
123
FEEDBACK_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_FEEDBACK_EMAIL_SUBJECT',
124
                                 'Feedback from %s alpha2 testing' % SITENAME)
125
VERIFICATION_EMAIL_SUBJECT = getattr(
126
    settings, 'ASTAKOS_VERIFICATION_EMAIL_SUBJECT',
127
    '%s alpha2 testing account activation is needed' % SITENAME)
128
ACCOUNT_CREATION_SUBJECT = getattr(
129
    settings, 'ASTAKOS_ACCOUNT_CREATION_SUBJECT',
130
    '%s alpha2 testing account created (%%(user)s)' % SITENAME)
131
GROUP_CREATION_SUBJECT = getattr(
132
    settings, 'ASTAKOS_GROUP_CREATION_SUBJECT',
133
    '%s alpha2 testing group created (%%(group)s)' % SITENAME)
134
HELPDESK_NOTIFICATION_EMAIL_SUBJECT = getattr(
135
    settings, 'ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT',
136
    '%s alpha2 testing account activated (%%(user)s)' % SITENAME)
137
EMAIL_CHANGE_EMAIL_SUBJECT = getattr(
138
    settings, 'ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT',
139
    'Email change on %s alpha2 testing' % SITENAME)
140
PASSWORD_RESET_EMAIL_SUBJECT = getattr(
141
    settings, 'ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT',
142
    'Password reset on %s alpha2 testing' % SITENAME)
143
PROJECT_CREATION_SUBJECT = getattr(
144
    settings, 'ASTAKOS_PROJECT_CREATION_SUBJECT',
145
    '%s alpha2 testing project application created (%%(name)s)' % SITENAME)
146
PROJECT_APPROVED_SUBJECT = getattr(
147
    settings, 'ASTAKOS_PROJECT_APPROVED_SUBJECT',
148
    '%s alpha2 testing project application approved (%%(name)s)' % SITENAME)
149
PROJECT_TERMINATION_SUBJECT = getattr(
150
    settings, 'ASTAKOS_PROJECT_TERMINATION_SUBJECT',
151
    '%s alpha2 testing project terminated (%%(name)s)' % SITENAME)
152
PROJECT_SUSPENSION_SUBJECT = getattr(
153
    settings, 'ASTAKOS_PROJECT_SUSPENSION_SUBJECT',
154
    '%s alpha2 testing project suspended (%%(name)s)' % SITENAME)
155
PROJECT_MEMBERSHIP_CHANGE_SUBJECT = getattr(
156
    settings, 'ASTAKOS_PROJECT_MEMBERSHIP_CHANGE_SUBJECT',
157
    '%s alpha2 testing project membership changed (%%(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
        'url': 'https://node1.example.com/ui/',
167
        'resources': [{
168
            'name':'disk',
169
            'group':'compute',
170
            'uplimit':30*1024*1024*1024,
171
            'unit':'bytes',
172
            'desc': 'Virtual machine disk size'
173
            },{
174
            'name':'cpu',
175
            'group':'compute',
176
            'uplimit':6,
177
            'desc': 'Number of virtual machine processors'
178
            },{
179
            'name':'ram',
180
            'group':'compute',
181
            'uplimit':6*1024*1024*1024,
182
            'unit':'bytes',
183
            'desc': 'Virtual machines'
184
            },{
185
            'name':'vm',
186
            'group':'compute',
187
            'uplimit':2,
188
            'desc': 'Number of virtual machines'
189
            },{
190
            'name':'network.private',
191
            'group':'network',
192
            'uplimit':1,
193
            'desc': 'Private networks'
194
            }
195
        ]
196
    },
197
    'pithos+': {
198
        'url': 'https://node2.example.com/ui/',
199
        'resources':[{
200
            'name':'diskspace',
201
            'group':'storage',
202
            'uplimit':5 * 1024 * 1024 * 1024,
203
            'unit':'bytes',
204
            'desc': 'Pithos account diskspace'
205
            }]
206
    }
207
})
208

    
209
# Set the billing URI
210
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')
211

    
212
# Set how many objects should be displayed per page
213
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
214

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

    
218
# Enforce token renewal on password change/reset
219
NEWPASSWD_INVALIDATE_TOKEN = getattr(
220
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
221

    
222

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

    
295
        }
296

    
297
    })
298

    
299
# Permit local account migration
300
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
301

    
302
# Strict shibboleth usage
303
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
304
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
305
                                       False)