-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
66 lines (61 loc) · 2.36 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os, random, string
from flask_security.utils import uia_username_mapper
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
# Secret key used by different plugins (ie. Flask-Security, Flask-WTF)
SECRET_KEY = os.environ.get('SECRET_KEY', ''.join(random.choice(string.ascii_lowercase) for i in range(32)))
# Database (Flask-SQLAlchemy): Options
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI', 'mysql://admin:admin@localhost/trivialis_dev')
SQLALCHEMY_TRACK_MODIFICATIONS = False
# Localization (Flask-Babel): Available Languages
LANGUAGES = [
{
'name': 'English',
'isoCode': 'en',
'icon': 'gb'
},
{
'name': 'Deutsch',
'isoCode': 'de',
'icon': 'de'
}
]
# Authentication (Flask-Security): Core
USER_ROLES = [
{
'name': 'Admin',
'description': 'Admin users can manage the application.',
'permissions': {'admin-read', 'admin-write'}
},
{
'name': 'Teacher',
'description': 'Teachers can manage their tenant and enable or disable stories.',
'permissions': {'teacher-read', 'teacher-write'}
},
{
'name': 'User',
'description': 'Users can interact with the application and configure their profile.',
'permissions': {'user-read', 'user-write'}
}
]
SECURITY_PASSWORD_SALT = os.environ.get('PASSWORD_SALT', 'lkuibefkjbdmybcazwvefoauflbvclszydvfkahaqiuehgf')
SECURITY_USER_IDENTITY_ATTRIBUTES = [
{'username': {'mapper': uia_username_mapper, 'case_insensitive': True}}
]
# Authentication (Flask-Security): Compatibility
SECURITY_ANONYMOUS_USER_DISABLED = True
# Authentication (Flask-Security): Login/Logout
#SECURITY_LOGOUT_METHODS = ['Post']
# Authentication (Flask-Security): Registerable
SECURITY_REGISTERABLE = True
SECURITY_SEND_REGISTER_EMAIL = False # Make this dependent on environment (nonprod, prod)
SECURITY_USERNAME_ENABLE = True
SECURITY_USERNAME_REQUIRED = True # School kids don't necessarily have an email address
SECURITY_USERNAME_MINLENGTH = 3 # Think of short names like Ben or Tom
SECURITY_USERNAME_MAXLENGTH = 32
# Authentication (Flask-Security): Changeable
SECURITY_CHANGEABLE = True
SECURITY_SEND_PASSWORD_CHANGE_EMAIL = False
# Authentication (Flask-Security): Recoverable
SECURITY_RECOVERABLE = True # Verify implementation
SECURITY_SEND_PASSWORD_RESET_EMAIL = False