-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiconfig.py
49 lines (40 loc) · 1.36 KB
/
apiconfig.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
import os
import ConfigParser
_basedir = os.path.abspath(os.path.dirname(__file__))
DATABASE_FILE = 'faro.db'
class Config(object):
DEBUG = False
TESTING = False
DATABASE_CONNECT_OPTIONS = {}
DEFAULT_PAGE_SIZE = 15
MAXIMUM_PAGE_SIZE = 100
AUTH_STRATEGY = 'faro_api.middleware.auth.noauth.NoAuthMiddleware'
"""PAGINATION CONSTANTS"""
PAGE_QUERY = 'p'
PAGE_SIZE_QUERY = 'page_size'
PAGE_TOTAL_QUERY = 'total'
PAGE_NUMBER_QUERY = 'page_number'
PAGE_NEXT = 'next'
PAGE_PREVIOUS = 'prev'
class DevelopmentConfig(Config):
db_user = 'root'
db_password = 'password'
db_host = 'localhost'
db_name = 'faro_api'
try:
with open('/etc/faro-api/faro-api.conf'):
config = ConfigParser.SafeConfigParser(
{'db_user': db_user, 'db_password': db_password,
'db_host': db_host, 'db_name': db_name})
config.read('/etc/faro-api/faro-api.conf')
db_user = config.get('faro_api', 'db_user')
db_password = config.get('faro_api', 'db_password')
db_host = config.get('faro_api', 'db_host')
db_name = config.get('faro_api', 'db_name')
except IOError:
pass
uri = "mysql://%s:%s@%s/%s" % (db_user, db_password, db_host, db_name)
DATABASE_URI = uri
class TestConfig(Config):
DEBUG = True
TESTING = True