Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / im / settings.py @ 55c99c1c

History | View | Annotate | Download (10 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':'group compute help text',
201
                'is_abbreviation':False,
202
                'report_desc':'',
203
                 'verbose_name':'compute',
204
            },
205
            'storage': {
206
                'help_text':'group storage help text',
207
                'is_abbreviation':False,
208
                'report_desc':'',
209
                 'verbose_name':'storage',
210
            },
211
        },
212
        'resources': {
213
            'pithos+.diskspace': {
214
                'help_text':'resource pithos+.diskspace help text',
215
                'is_abbreviation':False,
216
                'report_desc':'Pithos+ Diskspace',
217
                'placeholder':'eg. 10GB',
218
                'verbose_name':'diskspace',
219
            },
220
            'cyclades.vm': {
221
                'help_text':'resource cyclades.vm help text resource cyclades.vm help text resource cyclades.vm help text resource cyclades.vm help text',
222
                'is_abbreviation':True,
223
                'report_desc':'Virtual Machines',
224
                'placeholder':'eg. 2',
225
                'verbose_name':'vm',
226
            },
227
            'cyclades.disk': {
228
                'help_text':'resource cyclades.disk help text',
229
                'is_abbreviation':False,
230
                'report_desc':'Disk',
231
                'placeholder':'eg. 5GB, 2GB etc',
232
                'verbose_name':'disk'
233
            },
234
            'cyclades.ram': {
235
                'help_text':'resource cyclades.ram help text',
236
                'is_abbreviation':True,
237
                'report_desc':'RAM',
238
                'placeholder':'eg. 4GB',
239
                'verbose_name':'ram'
240
            },
241
            'cyclades.cpu': {
242
                'help_text':'resource cyclades.cpu help text',
243
                'is_abbreviation':True,
244
                'report_desc':'CPUs',
245
                'placeholder':'eg. 1',
246
                'verbose_name':'cpu'
247
            },
248
            'cyclades.network.private': {
249
                'help_text':'resource cyclades.network.private help text',
250
                'is_abbreviation':False,
251
                'report_desc':'Network',
252
                'placeholder':'eg. 1',
253
                'verbose_name':'private network'
254
            }
255

    
256
        }
257

    
258
    })
259

    
260
# Permit local account migration
261
ENABLE_LOCAL_ACCOUNT_MIGRATION = getattr(settings, 'ASTAKOS_ENABLE_LOCAL_ACCOUNT_MIGRATION', True)