forked from Github-Mirrors/canaille
better error messages
This commit is contained in:
parent
22f18f8cf2
commit
b3e11e1d2f
1 changed files with 12 additions and 5 deletions
|
@ -41,7 +41,10 @@ def create_app(config=None):
|
||||||
dir_path = os.path.dirname(os.path.realpath(__file__))
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
app.config.from_mapping(
|
app.config.from_mapping(
|
||||||
{"SESSION_COOKIE_NAME": "canaille", "OAUTH2_REFRESH_TOKEN_GENERATOR": True,}
|
{
|
||||||
|
"SESSION_COOKIE_NAME": "canaille",
|
||||||
|
"OAUTH2_REFRESH_TOKEN_GENERATOR": True,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
if config:
|
if config:
|
||||||
app.config.from_mapping(config)
|
app.config.from_mapping(config)
|
||||||
|
@ -59,10 +62,14 @@ def create_app(config=None):
|
||||||
|
|
||||||
setup_dev_keypair(app)
|
setup_dev_keypair(app)
|
||||||
|
|
||||||
if not os.path.exists(app.config["JWT"]["PUBLIC_KEY"]) or not os.path.exists(
|
if not os.path.exists(app.config["JWT"]["PUBLIC_KEY"]):
|
||||||
app.config["JWT"]["PRIVATE_KEY"]
|
raise Exception(f'Public key does not exist {app.config["JWT"]["PUBLIC_KEY"]}')
|
||||||
):
|
|
||||||
raise Exception("Invalid keypair")
|
if not os.path.exists(app.config["JWT"]["PRIVATE_KEY"]):
|
||||||
|
raise Exception(
|
||||||
|
f'Private key does not exist {app.config["JWT"]["PRIVATE_KEY"]}'
|
||||||
|
)
|
||||||
|
|
||||||
setup_app(app)
|
setup_app(app)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
Loading…
Reference in a new issue