settings.py 6.04 KB
Newer Older
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
1 2 3 4 5 6 7 8 9 10 11 12 13
from django.conf import settings

# Set the expiration time of newly created auth tokens
# to be this many hours after their creation time.
AUTH_TOKEN_DURATION = getattr(settings, 'ASTAKOS_AUTH_TOKEN_DURATION', 30 * 24)

# Authenticate via Twitter.
TWITTER_KEY = getattr(settings, 'ASTAKOS_TWITTER_KEY', '')
TWITTER_SECRET = getattr(settings, 'ASTAKOS_TWITTER_SECRET', '')

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

INVITATIONS_PER_LEVEL = getattr(settings, 'ASTAKOS_INVITATIONS_PER_LEVEL', {
14 15 16 17 18
    0: 100,
    1: 2,
    2: 0,
    3: 0,
    4: 0
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
19 20 21
})

# Address to use for outgoing emails
22 23
DEFAULT_CONTACT_EMAIL = getattr(
    settings, 'ASTAKOS_DEFAULT_CONTACT_EMAIL', 'support@cloud.grnet.gr')
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
24 25

# Identity Management enabled modules
26
IM_MODULES = getattr(settings, 'ASTAKOS_IM_MODULES', ['local', 'shibboleth'])
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
27 28 29 30 31 32 33 34 35

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

#Enable invitations
INVITATIONS_ENABLED = getattr(settings, 'ASTAKOS_INVITATIONS_ENABLED', True)

COOKIE_NAME = getattr(settings, 'ASTAKOS_COOKIE_NAME', '_pithos2_a')
COOKIE_DOMAIN = getattr(settings, 'ASTAKOS_COOKIE_DOMAIN', None)
36
COOKIE_SECURE = getattr(settings, 'ASTAKOS_COOKIE_SECURE', True)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
37

38
IM_STATIC_URL = getattr(settings, 'ASTAKOS_IM_STATIC_URL', '/static/im/')
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
39

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

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

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

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

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

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

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

# Set user email patterns that are automatically activated
67 68
RE_USER_EMAIL_PATTERNS = getattr(
    settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
69

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

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

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

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

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

90
# The number of unsuccessful login requests per minute allowed for a specific user
91 92
RATELIMIT_RETRIES_ALLOWED = getattr(
    settings, 'ASTAKOS_RATELIMIT_RETRIES_ALLOWED', 3)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
93

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

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

101
# Set the astakos main functions logging severity (None to disable)
102
from logging import INFO
103
LOGGING_LEVEL = getattr(settings, 'ASTAKOS_LOGGING_LEVEL', INFO)
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
104

105
# Set the quota holder component URI
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
106 107
QUOTA_HOLDER_URL = getattr(settings, 'ASTAKOS_QUOTA_HOLDER_URL', '')

108 109 110 111 112 113 114
# Set the cloud service properties
SERVICES = getattr(settings, 'ASTAKOS_SERVICES',
                   {'cyclades': {'url':'https://node1.example.com/ui/',
                                 'quota': {'vm': 2}},
                    'pithos+':  {'url':'https://node2.example.com/ui/',
                                 'quota': {'diskspace': 50 * 1024 * 1024 * 1024}}})

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
115 116
# Set the billing URI
AQUARIUM_URL = getattr(settings, 'ASTAKOS_AQUARIUM_URL', '')
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134

# Configurable email subjects
INVITATION_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_INVITATION_EMAIL_SUBJECT',
        'Invitation to %s alpha2 testing' % SITENAME)
GREETING_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_GREETING_EMAIL_SUBJECT',
        'Welcome to %s alpha2 testing' % SITENAME)
FEEDBACK_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_FEEDBACK_EMAIL_SUBJECT',
        'Feedback from %s alpha2 testing' % SITENAME)
VERIFICATION_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_VERIFICATION_EMAIL_SUBJECT',
        '%s alpha2 testing account activation is needed' % SITENAME)
ADMIN_NOTIFICATION_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_ADMIN_NOTIFICATION_EMAIL_SUBJECT',
        '%s alpha2 testing account created (%%(user)s)' % SITENAME)
HELPDESK_NOTIFICATION_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_HELPDESK_NOTIFICATION_EMAIL_SUBJECT',
        '%s alpha2 testing account activated (%%(user)s)' % SITENAME)
EMAIL_CHANGE_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_EMAIL_CHANGE_EMAIL_SUBJECT',
        'Email change on %s alpha2 testing' % SITENAME)
PASSWORD_RESET_EMAIL_SUBJECT = getattr(settings, 'ASTAKOS_PASSWORD_RESET_EMAIL_SUBJECT',
        'Password reset on %s alpha2 testing' % SITENAME)
135

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
136 137
# Set how many objects should be displayed per page
PAGINATE_BY = getattr(settings, 'ASTAKOS_PAGINATE_BY', 10)