Exemplo n.º 1
0
    print("Changing bt.json_loads from %s to %s" %
          (bt.json_loads, bson.json_util.loads))
    bt.json_loads = bson.json_util.loads

    # The selection of SSL versus non-SSL should really be done through a config
    # option and not through editing source code, so let's make this keyed off the
    # port number
    if server_port == "443":
        # We support SSL and want to use it
        key_file = open('conf/net/keys.json')
        key_data = json.load(key_file)
        host_cert = key_data["host_certificate"]
        chain_cert = key_data["chain_certificate"]
        private_key = key_data["private_key"]

        run(host=server_host,
            port=server_port,
            server='cheroot',
            debug=True,
            certfile=host_cert,
            chainfile=chain_cert,
            keyfile=private_key)
    else:
        # Non SSL option for testing on localhost
        print(
            "Running with HTTPS turned OFF - use a reverse proxy on production"
        )
        run(host=server_host, port=server_port, server='cheroot', debug=True)

    # run(host="0.0.0.0", port=server_port, server='cherrypy', debug=True)
Exemplo n.º 2
0
    # We have see the sockets hang in practice. Let's set the socket timeout = 1
    # hour to be on the safe side, and see if it is hit.
    socket.setdefaulttimeout(float(socket_timeout))

    for plugin in app.plugins:
        if isinstance(plugin, JSONPlugin):
            print("Replaced json_dumps in plugin with the one from bson")
            plugin.json_dumps = bson.json_util.dumps

    print("Changing bt.json_loads from %s to %s" % (bt.json_loads, bson.json_util.loads))
    bt.json_loads = bson.json_util.loads

    # The selection of SSL versus non-SSL should really be done through a config
    # option and not through editing source code, so let's make this keyed off the
    # port number
    if server_port == "443":
      # We support SSL and want to use it
      key_file = open('conf/net/keys.json')
      key_data = json.load(key_file)
      ssl_cert = key_data["ssl_certificate"]
      private_key = key_data["private_key"]

      run(host=server_host, port=server_port, server='cheroot', debug=True,
          certfile=ssl_cert, keyfile=private_key, ssl_module='builtin')
    else:
      # Non SSL option for testing on localhost
      print("Running with HTTPS turned OFF - use a reverse proxy on production")
      run(host=server_host, port=server_port, server='cheroot', debug=True)

    # run(host="0.0.0.0", port=server_port, server='cherrypy', debug=True)
Exemplo n.º 3
0
    # hour to be on the safe side, and see if it is hit.
    socket.setdefaulttimeout(float(socket_timeout))

    for plugin in app.plugins:
        if isinstance(plugin, JSONPlugin):
            print("Replaced json_dumps in plugin with the one from bson")
            plugin.json_dumps = bson.json_util.dumps

    print("Changing bt.json_loads from %s to %s" % (bt.json_loads, bson.json_util.loads))
    bt.json_loads = bson.json_util.loads

    # The selection of SSL versus non-SSL should really be done through a config
    # option and not through editing source code, so let's make this keyed off the
    # port number
    if server_port == "443":
      # We support SSL and want to use it
      key_file = open('conf/net/keys.json')
      key_data = json.load(key_file)
      host_cert = key_data["host_certificate"]
      chain_cert = key_data["chain_certificate"]
      private_key = key_data["private_key"]

      run(host=server_host, port=server_port, server='cheroot', debug=True,
          certfile=host_cert, chainfile=chain_cert, keyfile=private_key)
    else:
      # Non SSL option for testing on localhost
      print("Running with HTTPS turned OFF - use a reverse proxy on production")
      run(host=server_host, port=server_port, server='cheroot', debug=True)

    # run(host="0.0.0.0", port=server_port, server='cherrypy', debug=True)
Exemplo n.º 4
0
    print("Changing bt.json_loads from %s to %s" %
          (bt.json_loads, bson.json_util.loads))
    bt.json_loads = bson.json_util.loads

    # The selection of SSL versus non-SSL should really be done through a config
    # option and not through editing source code, so let's make this keyed off the
    # port number
    if server_port == "443":
        # We support SSL and want to use it
        key_file = open('conf/net/keys.json')
        key_data = json.load(key_file)
        ssl_cert = key_data["ssl_certificate"]
        private_key = key_data["private_key"]

        run(host=server_host,
            port=server_port,
            server='cheroot',
            debug=True,
            certfile=ssl_cert,
            keyfile=private_key,
            ssl_module='builtin')
    else:
        # Non SSL option for testing on localhost
        print(
            "Running with HTTPS turned OFF - use a reverse proxy on production"
        )
        run(host=server_host, port=server_port, server='cheroot', debug=True)

    # run(host="0.0.0.0", port=server_port, server='cherrypy', debug=True)