main.py - fixed file imports

This commit is contained in:
Oscar Krause 2022-12-19 14:27:10 +01:00
parent 15acb6fdbe
commit 1f8f85479f

View File

@ -1,7 +1,7 @@
from base64 import b64encode from base64 import b64encode
from hashlib import sha256 from hashlib import sha256
from uuid import uuid4 from uuid import uuid4
from os.path import join, dirname
from fastapi import FastAPI, HTTPException from fastapi import FastAPI, HTTPException
from fastapi.requests import Request from fastapi.requests import Request
import json import json
@ -22,8 +22,8 @@ LEASE_EXPIRE_DELTA = relativedelta(minutes=15) # days=90
URL = '192.168.178.196' URL = '192.168.178.196'
SITE_KEY_XID = '00000000-0000-0000-0000-000000000000' SITE_KEY_XID = '00000000-0000-0000-0000-000000000000'
INSTANCE_KEY_RSA = load_key('cert/instance.private.pem') INSTANCE_KEY_RSA = load_key(join(dirname(__file__), 'cert/instance.private.pem'))
INSTANCE_KEY_PUB = load_key('cert/instance.public.pem') INSTANCE_KEY_PUB = load_key(join(dirname(__file__), 'cert/instance.public.pem'))
@app.get('/') @app.get('/')
@ -291,7 +291,7 @@ if __name__ == '__main__':
print(f'> Starting dev-server ...') print(f'> Starting dev-server ...')
ssl_keyfile = 'cert/webserver.key' ssl_keyfile = join(dirname(__file__), 'cert/webserver.key')
ssl_certfile = 'cert/webserver.crt' ssl_certfile = join(dirname(__file__), 'cert/webserver.crt')
uvicorn.run('main:app', host='0.0.0.0', port=443, ssl_keyfile=ssl_keyfile, ssl_certfile=ssl_certfile, reload=True) uvicorn.run('main:app', host='0.0.0.0', port=443, ssl_keyfile=ssl_keyfile, ssl_certfile=ssl_certfile, reload=True)