[core] Add ssl options

This commit is contained in:
Cathy Hu 2020-09-11 18:21:24 +02:00
parent 10cec2ac6d
commit b2cafa81ac
2 changed files with 8 additions and 4 deletions

View file

@ -24,13 +24,15 @@ from sys import argv
config = {
'database_connection': 'sqlite:////tmp/kibicara.sqlite',
'frontend_url': 'http://127.0.0.1:4200', # dev default
'behind_proxy': False,
'frontend_url': 'http://127.0.0.1:4200', # url of frontend, change in prod
# production params
'frontend_path': None,
'frontend_path': None, # required, path to frontend html/css/js files
'production': True,
'behind_proxy': False,
'keyfile': None, # optional for ssl
'certfile': None, # optional for ssl
# dev params
'root_url': 'http://localhost:8000',
'root_url': 'http://localhost:8000', # url of backend
'cors_allow_origin': 'http://127.0.0.1:4200',
}
""" Default configuration.

View file

@ -58,6 +58,8 @@ class Main:
server_config = Config()
server_config.accesslog = '-'
server_config.behind_proxy = config['behind_proxy']
server_config.keyfile = config['keyfile']
server_config.certfile = config['certfile']
if config['production']:
server_config.bind = ['0.0.0.0:8000', '[::]:8000']
api = FastAPI()