-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
155 lines (125 loc) · 3.79 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import os
from os.path import join, dirname
from datetime import timedelta
from dotenv import load_dotenv
import logging
from logging.handlers import SysLogHandler
if os.path.isfile('.env'):
load_dotenv('.env')
class Config:
"""Base configuration"""
APP_ENV = os.environ.get('APP_ENV', 'development')
SECRET_KEY = os.environ.get('SECRET_KEY')
VERIFY_TOKEN = os.environ.get('VERIFY_TOKEN')
ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN')
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = join(
dirname(__file__),
os.environ["GOOGLE_SERVICE_ACCOUNT_KEYS"],
)
STORMGLASS_URL = os.environ.get('STORMGLASS_URL')
STORMGLASS_API_KEY = os.environ.get('STORMGLASS_API_KEY')
STORMGLASS_API_KEY_2 = os.environ.get('STORMGLASS_API_KEY_2')
DIALOGFLOW_URL = os.environ.get('DIALOGFLOW_URL')
DIALOGFLOW_PROJECT_ID = os.environ.get('DIALOGFLOW_PROJECT_ID')
DIALOGFLOW_CLIENT_ACCESS_TOKEN = os.environ.get(
'DIALOGFLOW_CLIENT_ACCESS_TOKEN',
)
DEBUG = False
TESTING = False
WTF_CSRF_ENABLED = False
PERMANENT_SESSION_LIFETIME = timedelta(days=7)
SESSION_COOKIE_NAME = 'session'
LOCATION_INTENTS = ['Location Forecast Intent']
LOCATION_AND_PARAMS_INTENTS = ['Specific Weather Parameters Intent']
FORECAST_RESPONSE_INTENTS = [
'Location Forecast Intent',
'Specific Weather Parameters Intent',
]
SUPPORTED_PARAMETERS = {
'Current Speed': 'currentSpeed',
'Swell Height': 'swellHeight',
'Swell Period': 'swellPeriod',
'Wave Height': 'waveHeight',
'Wave Period': 'wavePeriod',
'Air Temperature': 'airTemperature',
'Water Temperature': 'waterTemperature',
}
SUPPORTED_LOCATIONS = {
'Costa da Caparica': {
'latitude': 38.612310,
'longitude': -9.216585
},
'Carcavelos': {
'latitude': 38.678642,
'longitude': -9.336061
},
'Guincho': {
'latitude': 28.926815,
'longitude': -13.634419
},
'Ericeira': {
'latitude': 38.966493,
'longitude': -9.417617,
},
'Nazare': {
'latitude': 39.596779,
'longitude': -9.069571,
},
'Peniche': {
'latitude': 39.361859,
'longitude': -9.368651,
},
'Figueira da Foz': {
'latitude': 40.15085,
'longitude': -8.86179,
},
'Arrifana': {
'latitude': 40.91565,
'longitude': -8.49657,
},
'Sagres': {
'latitude': 37.068012,
'longitude': -8.830784,
},
"Ribeira d'Ilhas": {
'latitude': 38.987704,
'longitude': -9.418905,
},
'Amado': {
'latitude': 37.16949527,
'longitude': -8.90052003,
}
}
@classmethod
def init_app(cls, app):
pass
class DevelopmentConfig(Config):
"""Development configuration"""
DEBUG = True
@classmethod
def init_app(cls, app):
super(DevelopmentConfig, cls).init_app(app)
syslog_handler = SysLogHandler()
syslog_handler.setLevel(logging.WARNING)
app.logger.addHandler(syslog_handler)
class TestingConfig(Config):
"""Testing configuration"""
DEBUG = True
TESTING = True
PRESERVE_CONTEXT_ON_EXCEPTION = False
RQ_ASYNC = False
class StagingConfig(Config):
""" Staging configuration"""
DEBUG = False
SESSION_COOKIE_SECURE = True
class ProductionConfig(Config):
"""Production configuration"""
DEBUG = False
SESSION_COOKIE_SECURE = True
config = {
'development': DevelopmentConfig,
'staging': StagingConfig,
'production': ProductionConfig,
'testing': TestingConfig,
}
__all__ = ['config']