Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if USE_UVICORN:
uvicorn.run(
app,
host='0.0.0.0',
port=9009,
ssl_keyfile=keyfile,
ssl_certfile=certfile
)
else:
config = Config()
config.bind = ["0.0.0.0:9009"]
config.loglevel = 'debug'
# config.certfile = certfile
# config.keyfile = keyfile
asyncio.run(serve(app, config))
certfile = os.path.expanduser(f"~/.keys/{hostname}.crt")
keyfile = os.path.expanduser(f"~/.keys/{hostname}.key")
if USE_UVICORN:
uvicorn.run(app, host='0.0.0.0', port=9009,
ssl_keyfile=keyfile, ssl_certfile=certfile)
else:
config = Config()
config.bind = ["0.0.0.0:9009"]
config.loglevel = 'debug'
config.certfile = certfile
config.keyfile = keyfile
# config.verify_flags = ssl.VERIFY_X509_TRUSTED_FIRST
# config.verify_mode = ssl.CERT_NONE
# config.ciphers = "TLSv1"
asyncio.run(serve(app, config))
# Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_CIPHER_SERVER_PREFERENCE|OP_SINGLE_DH_USE|OP_SINGLE_ECDH_USE|OP_NO_COMPRESSION
def run_http_server(args):
os.environ['HTTPKOM_SETTINGS'] = args.config
init_app(app)
config = Config()
config.bind = ["{}:{}".format(args.host, args.port)]
asyncio.run(serve(app, config))
async def main():
await hypercorn.asyncio.serve(app, hypercorn.Config())
app.http_router.add({'GET'}, '/clickHandler.js', test_asset)
import uvicorn
from hypercorn.asyncio import serve
from hypercorn.config import Config
USE_UVICORN = False
if USE_UVICORN:
uvicorn.run(app, port=9009)
else:
config = Config()
config.bind = ["ugsb-rbla01.bhdgsystematic.com:9009"]
config.certfile = "/home/BHDGSYSTEMATIC.COM/rblackbourn/.keys/ugsb-rbla01.crt"
config.keyfile = "/home/BHDGSYSTEMATIC.COM/rblackbourn/.keys/ugsb-rbla01.key"
asyncio.run(serve(app, config))
from hypercorn.config import Config
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
shutdown_event = asyncio.Event()
def _signal_handler(*_: Any) -> None:
shutdown_event.set()
loop.add_signal_handler(signal.SIGTERM, _signal_handler)
loop.add_signal_handler(signal.SIGINT, _signal_handler)
config = Config()
config.bind = ["0.0.0.0:9009"]
loop.run_until_complete(
serve(
app,
config,
shutdown_trigger=shutdown_event.wait # type: ignore
)
from hypercorn.config import Config
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
shutdown_event = asyncio.Event()
def _signal_handler(*_: Any) -> None:
shutdown_event.set()
loop.add_signal_handler(signal.SIGTERM, _signal_handler)
loop.add_signal_handler(signal.SIGINT, _signal_handler)
config = Config()
config.bind = ["0.0.0.0:9009"]
loop.run_until_complete(
serve(
app,
config,
shutdown_trigger=shutdown_event.wait # type: ignore
)
shutdown_event = asyncio.Event()
def _signal_handler(*_: Any) -> None:
shutdown_event.set()
loop.add_signal_handler(signal.SIGTERM, _signal_handler)
loop.add_signal_handler(signal.SIGINT, _signal_handler)
config = Config()
config.bind = ["0.0.0.0:9009"]
config.loglevel = 'debug'
# config.certfile = os.path.expanduser(f"~/.keys/server.crt")
# config.keyfile = os.path.expanduser(f"~/.keys/server.key")
loop.run_until_complete(
serve(
app,
config,
shutdown_trigger=shutdown_event.wait # type: ignore
)
if debug is not None:
self.debug = debug
config.errorlog = config.accesslog
config.keyfile = keyfile
config.use_reloader = use_reloader
scheme = "https" if config.ssl_enabled else "http"
print( # noqa: T001, T002
"Running on {}://{} (CTRL + C to quit)".format(scheme, config.bind[0])
)
if loop is not None:
loop.set_debug(debug or False)
loop.run_until_complete(serve(self, config))
else:
asyncio.run(serve(self, config), debug=config.debug)