Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 74796dd8

History | View | Annotate | Download (11.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
# 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(settings, 'ASTAKOS_GROUP_CREATION_SUBJECT',
132
                                 '%s alpha2 testing group created (%%(group)s)' % SITENAME)
133
HELPDESK_NOTIFICATION_EMAIL_SUBJECT = getattr(
134
    settings, 'ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT',
135
    '%s alpha2 testing account activated (%%(user)s)' % SITENAME)
136
EMAIL_CHANGE_EMAIL_SUBJECT = getattr(
137
    settings, 'ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT',
138
    'Email change on %s alpha2 testing' % SITENAME)
139
PASSWORD_RESET_EMAIL_SUBJECT = getattr(
140
    settings, 'ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT',
141
    'Password reset on %s alpha2 testing' % SITENAME)
142

    
143
# Set the quota holder component URI
144
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
145
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
146

    
147
# Set the cloud service properties
148
SERVICES = getattr(settings, 'ASTAKOS_SERVICES', {
149
    'cyclades': {
150
        'url': 'https://node1.example.com/ui/',
151
        'resources': [{
152
            'name':'vm',
153
            'group':'compute',
154
            'uplimit':2,
155
            'desc': 'Number of virtual machines'
156
            },{
157
            'name':'disk',
158
            'group':'compute',
159
            'uplimit':30*1024*1024*1024,
160
            'unit':'bytes',
161
            'desc': 'Virtual machine disk size'
162
            },{
163
            'name':'cpu',
164
            'group':'compute',
165
            'uplimit':6,
166
            'desc': 'Number of virtual machine processors'
167
            },{
168
            'name':'ram',
169
            'group':'compute',
170
            'uplimit':6*1024*1024*1024,
171
            'unit':'bytes',
172
            'desc': 'Virtual machines'
173
            },{
174
            'name':'network.private',
175
            'group':'network',
176
            'uplimit':1,
177
            'desc': 'Private networks'
178
            }
179
        ]
180
    },
181
    'pithos+': {
182
        'url': 'https://node2.example.com/ui/',
183
        'resources':[{
184
            'name':'diskspace',
185
            'group':'storage',
186
            'uplimit':5 * 1024 * 1024 * 1024,
187
            'unit':'bytes',
188
            'desc': 'Pithos account diskspace'
189
            }]
190
    }
191
})
192

    
193
# Set the billing URI
194
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')
195

    
196
# Set how many objects should be displayed per page
197
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
198

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

    
202
# Enforce token renewal on password change/reset
203
NEWPASSWD_INVALIDATE_TOKEN = getattr(
204
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
205

    
206

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

    
279
        }
280

    
281
    })
282

    
283
# Permit local account migration
284
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)
285

    
286
# Strict shibboleth usage
287
SHIBBOLETH_REQUIRE_NAME_INFO = getattr(settings,
288
                                       'ASTAKOS_SHIBBOLETH_REQUIRE_NAME_INFO',
289
                                       False)