Add cert generation based off of hostname

This commit is contained in:
Brikwerk 2021-09-22 23:55:33 -07:00
commit 6fee957569

View file

@ -2,6 +2,7 @@ import json
import os import os
from threading import RLock from threading import RLock
import time import time
from socket import gethostname
from .cert import generate_cert from .cert import generate_cert
from ..nxbt import Nxbt, PRO_CONTROLLER from ..nxbt import Nxbt, PRO_CONTROLLER
@ -144,7 +145,7 @@ def start_web_app(ip='0.0.0.0', port=8000, usessl=False, cert_path=None):
"\n" "\n"
) )
print("Generating certificates...") print("Generating certificates...")
cert, key = generate_cert('localhost') cert, key = generate_cert(gethostname())
with open(cert_path, "wb") as f: with open(cert_path, "wb") as f:
f.write(cert) f.write(cert)
with open(key_path, "wb") as f: with open(key_path, "wb") as f: