File size: 819 Bytes
393804b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | """Replace this minimal server with the frozen offline reference."""
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import os
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/healthz':
body = b'ok\n'
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
else:
body = b'Replace the scaffold reference implementation.\n'
self.send_response(200)
self.send_header('Content-Type', 'text/plain')
self.send_header('Content-Length', str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, format, *args):
return
ThreadingHTTPServer(('0.0.0.0', int(os.environ.get('PORT', '8080'))), Handler).serve_forever()
|