forked from entrepreneur-interet-general/solidata_backend
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wsgi_prod.py
58 lines (41 loc) · 1.52 KB
/
wsgi_prod.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
import os
from log_config import log, pformat
### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ###
### ENV VARS
### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ###
from dotenv import load_dotenv
from pathlib import Path # python3 only
env_path_global = Path('.') / '.env.global'
env_path_mongodb = Path('.') / '.env.mongodb'
env_path_mailing = Path('.') / '.env.mailing'
load_dotenv(env_path_global, verbose=True)
load_dotenv(env_path_mongodb, verbose=True)
load_dotenv(env_path_mailing, verbose=True)
### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ###
### FLASK-SOCKETIO
### + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ###
from flask_socketio import SocketIO
from auth_api.application import create_app
### READ ENV VARS
run=os.getenv('RUN_MODE', 'prod')
docker=os.getenv('DOCKER_MODE', 'docker_off')
mongodb=os.getenv('MONGODB_MODE', 'distant')
RSA=os.getenv('RSA_MODE', False)
anojwt=os.getenv('ANOJWT_MODE', False)
antispam=os.getenv('ANTISPAM_MODE', False)
antispam_val=os.getenv('ANTISPAM_VAL', 'my-string-to-check')
app = create_app(
app_name='TOKTOK_AUTH_API_PROD',
run_mode=run,
docker_mode=docker,
mongodb_mode=mongodb,
RSA_mode=RSA,
anojwt_mode=anojwt,
antispam_mode=antispam,
antispam_value=antispam_val,
)
### initiate socketio
socketio = SocketIO(app)
if __name__ == "main" :
log.debug("\n--- STARTING AUTH API (PROD) ---\n")
app.run()