#!/usr/bin/env python3
import http.server
import ssl
import os
import sys

os.chdir('/opt/oscilloscope/noVNC')

handler = http.server.SimpleHTTPRequestHandler
httpd = http.server.HTTPServer(('0.0.0.0', 443), handler)

context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain('/etc/ssl/certs/oscilloscope.crt', '/etc/ssl/private/oscilloscope.key')
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)

print('noVNC HTTPS sunucusu 443 portunda çalışıyor...', file=sys.stderr)
sys.stderr.flush()
httpd.serve_forever()
