def build_app(model_cache_dir,
token_secret,
client,
bot_user,
github_url,
email_address,
gunicorn_options):
"""Build the app object.
Parameters
----------
model_cache_dir : path-like
The path to the model directory.
token_secret : bytes
The shared secret for the uploader and irc server.
client : Library
The client used to fetch beatmaps.
bot_user : str
The username of the bot.
github_url : str
The url of the repo on github.
email_address : str
The email address for support / comments.
gunicorn_options : dict
Options to forward to gunicorn.
Returns
-------
app : App
The app to run.
"""
inner_app = flask.Flask(__name__)
inner_app.register_blueprint(
api,
model_cache_dir=pathlib.Path(model_cache_dir),
token_secret=Fernet(token_secret),
client=client,
bot_user=bot_user,
github_url=github_url,
email_address=email_address,
)
class app(BaseApplication):
def load(self):
return inner_app
def load_config(self, *, _cfg=gunicorn_options):
for k, v in _cfg.items():
k = k.lower()
if k in self.cfg.settings and v is not None:
self.cfg.set(k.lower(), v)
return app()
评论列表
文章目录