Allow configuration of openAPI interface

This commit is contained in:
Matthias
2020-12-27 15:54:05 +01:00
parent 1717121f10
commit 68d148e72d
3 changed files with 15 additions and 2 deletions

View File

@@ -26,8 +26,13 @@ class ApiServer(RPCHandler):
ApiServer._rpc = rpc
ApiServer._config = config
api_config = self._config['api_server']
self.app = FastAPI(title="Freqtrade API")
self.app = FastAPI(title="Freqtrade API",
openapi_url='openapi.json' if api_config.get(
'enable_openapi') else None,
redoc_url=None,
)
self.configure_app(self.app, self._config)
self.start_api()
@@ -92,10 +97,11 @@ class ApiServer(RPCHandler):
"Others may be able to log into your bot.")
logger.info('Starting Local Rest Server.')
verbosity = self._config['api_server'].get('verbosity', 'info')
uvconfig = uvicorn.Config(self.app,
port=rest_port,
host=rest_ip,
access_log=True)
access_log=True if verbosity != 'error' else False)
try:
self._server = UvicornServer(uvconfig)
self._server.run_in_thread()