Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 67be1883

History | View | Annotate | Download (11.2 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
# Authenticate via Twitter.
8
TWITTER_TOKEN = getattr(settings, 'ASTAKOS_TWITTER_TOKEN', '')
9
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')
10

    
11
DEFAULT_USER_LEVEL = getattr(settings, 'ASTAKOS_DEFAULT_USER_LEVEL', 4)
12

    
13
INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
14
    0: 100,
15
    1: 2,
16
    2: 0,
17
    3: 0,
18
    4: 0
19
})
20

    
21
# Address to use for outgoing emails
22
DEFAULT_CONTACT_EMAIL = getattr(
23
    settings, 'ASTAKOS_DEFAULT_CONTACT_EMAIL', 'support@cloud.grnet.gr')
24

    
25
# Identity Management enabled modules
26
# Supported modules are: 'local', 'twitter' and 'shibboleth'
27
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local'])
28

    
29
# Force user profile verification
30
FORCE_PROFILE_UPDATE = getattr(settings, 'ASTAKOS_FORCE_PROFILE_UPDATE', True)
31

    
32
#Enable invitations
33
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', False)
34

    
35
COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
36
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
37
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
38

    
39
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
40

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

    
44
# Set baseurl
45
BASEURL = getattr(settings, 'ASTAKOS_BASEURL', 'http://pithos.dev.grnet.gr')
46

    
47
# Set service name
48
SITENAME = getattr(settings, 'ASTAKOS_SITENAME', 'GRNET Cloud')
49

    
50
# Set recaptcha keys
51
RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
52
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '')
53
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS',
54
                            {'theme': 'custom', 'custom_theme_widget': 'okeanos_recaptcha'})
55
RECAPTCHA_USE_SSL = getattr(settings, 'ASTAKOS_RECAPTCHA_USE_SSL', True)
56
RECAPTCHA_ENABLED = getattr(settings, 'ASTAKOS_RECAPTCHA_ENABLED', False)
57

    
58
# set AstakosUser fields to propagate in the billing system
59
BILLING_FIELDS = getattr(settings, 'ASTAKOS_BILLING_FIELDS', ['is_active'])
60

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

    
64
# Set where the user should be redirected after logout
65
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
66

    
67
# Set user email patterns that are automatically activated
68
RE_USER_EMAIL_PATTERNS = getattr(
69
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
70

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

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

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

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

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

    
91
# The number of unsuccessful login requests per minute allowed for a specific user
92
RATELIMIT_RETRIES_ALLOWED = getattr(
93
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
94

    
95
# If False the email change mechanism is disabled
96
EMAILCHANGE_ENABLED = getattr(settings, 'ASTAKOS_EMAILCHANGE_ENABLED', False)
97

    
98
# Set the expiration time (in days) of email change requests
99
EMAILCHANGE_ACTIVATION_DAYS = getattr(
100
    settings, 'ASTAKOS_EMAILCHANGE_ACTIVATION_DAYS', 10)
101

    
102
# Set the astakos main functions logging severity (None to disable)
103
from logging import INFO
104
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
105

    
106
# Configurable email subjects
107
INVITATION_EMAIL_SUBJECT = getattr(
108
    settings, 'ASTAKOS_INVITATION_EMAIL_SUBJECT',
109
    'Invitation to %s alpha2 testing' % SITENAME)
110
GREETING_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_GREETING_EMAIL_SUBJECT',
111
                                 'Welcome to %s alpha2 testing' % SITENAME)
112
FEEDBACK_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_FEEDBACK_EMAIL_SUBJECT',
113
                                 'Feedback from %s alpha2 testing' % SITENAME)
114
VERIFICATION_EMAIL_SUBJECT = getattr(
115
    settings, 'ASTAKOS_VERIFICATION_EMAIL_SUBJECT',
116
    '%s alpha2 testing account activation is needed' % SITENAME)
117
ACCOUNT_CREATION_SUBJECT = getattr(
118
    settings, 'ASTAKOS_ACCOUNT_CREATION_SUBJECT',
119
    '%s alpha2 testing account created (%%(user)s)' % SITENAME)
120
GROUP_CREATION_SUBJECT = getattr(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

    
132
# Set the quota holder component URI
133
QUOTAHOLDER_URL = getattr(settings, 'ASTAKOS_QUOTAHOLDER_URL', '')
134
QUOTAHOLDER_TOKEN = getattr(settings, 'ASTAKOS_QUOTAHOLDER_TOKEN', '')
135

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

    
182
# Set the billing URI
183
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')
184

    
185
# Set how many objects should be displayed per page
186
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 8)
187

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

    
191
# Enforce token renewal on password change/reset
192
NEWPASSWD_INVALIDATE_TOKEN = getattr(
193
    settings, 'ASTAKOS_NEWPASSWD_INVALIDATE_TOKEN', True)
194

    
195

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

    
268
        }
269

    
270
    })
271

    
272
# Permit local account migration
273
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)