-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
31 lines (27 loc) · 1005 Bytes
/
run.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
from app import app
if __name__=="__main__":
with open("allium.cfg") as config_file:
for line in config_file:
if line.find('SSL_ENABLED') != -1:
ssl_enabled = line.split('"')[1::2][0]
if line.find('HOST') != -1:
host = line.split('"')[1::2][0]
if line.find('PORT') != -1:
port = line.split('"')[1::2][0]
if ((ssl_enabled == 'True') or (ssl_enabled=='adhoc')):
import ssl
if ssl_enabled==True:
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load_cert_chain('ssl/web.crt', 'ssl/web.key')
app.run(port=port, host=host, ssl_context=context)
else:
context = 'adhoc'
app.run(port=port, host=host, ssl_context=context)
elif ssl_enabled=='adhoc':
print("adhoc")
context='adhoc'
app.run(port=port,host=host,ssl_context=context)
else:
app.run(port=port, host=host)
else:
exit