[misc] Add behind_proxy and regroup config params

This commit is contained in:
Cathy Hu 2020-09-11 04:05:33 +02:00
parent 3025d8b05a
commit 754dbe6762
2 changed files with 6 additions and 2 deletions

View file

@ -24,10 +24,13 @@ from sys import argv
config = {
'database_connection': 'sqlite:////tmp/kibicara.sqlite',
'frontend_url': 'http://127.0.0.1:4200', # dev default
'behind_proxy': False,
# production params
'frontend_path': None,
'root_url': 'http://localhost:8000',
'frontend_url': 'http://127.0.0.1:4200',
'production': True,
# dev params
'root_url': 'http://localhost:8000',
'cors_allow_origin': 'http://127.0.0.1:4200',
}
""" Default configuration.

View file

@ -57,6 +57,7 @@ class Main:
app = FastAPI()
server_config = Config()
server_config.accesslog = '-'
server_config.behind_proxy = config['behind_proxy']
if config['production']:
server_config.bind = ['0.0.0.0:8000', '[::]:8000']
api = FastAPI()