mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Use ssl for flask server (#319)
* Use ssl for flask server * Use window location protocol to get https or http in frontend * Make use_ssl configurable * Remove log port in frontend
This commit is contained in:
parent
9ed4d79c78
commit
537bb8439b
4 changed files with 10 additions and 5 deletions
|
|
@ -32,6 +32,7 @@ rpc_port=8994
|
|||
enabled=true
|
||||
host=0.0.0.0
|
||||
port=12994
|
||||
use_ssl=false
|
||||
|
||||
[postgresql]
|
||||
host=db
|
||||
|
|
|
|||
|
|
@ -77,10 +77,7 @@ import {
|
|||
} from "../proto/squeak_admin_pb"
|
||||
|
||||
|
||||
export let web_host_port = 'http://' + window.location.hostname + ':' + window.location.port;
|
||||
|
||||
console.log("web_host_port:");
|
||||
console.log(web_host_port);
|
||||
export let web_host_port = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port;
|
||||
|
||||
|
||||
function makeRequest(route, request, handleResponse) {
|
||||
|
|
|
|||
|
|
@ -297,9 +297,10 @@ def create_app(handler):
|
|||
|
||||
class SqueakAdminWebServer():
|
||||
|
||||
def __init__(self, host, port, handler):
|
||||
def __init__(self, host, port, use_ssl, handler):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.use_ssl = use_ssl
|
||||
self.handler = handler
|
||||
self.app = create_app(handler)
|
||||
|
||||
|
|
@ -308,4 +309,5 @@ class SqueakAdminWebServer():
|
|||
self.host,
|
||||
self.port,
|
||||
debug=False,
|
||||
ssl_context='adhoc' if self.use_ssl else None,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ def load_admin_web_server(config, handler) -> SqueakAdminWebServer:
|
|||
return SqueakAdminWebServer(
|
||||
config["webadmin"]["host"],
|
||||
config["webadmin"]["port"],
|
||||
config["webadmin"].getboolean("use_ssl"),
|
||||
handler,
|
||||
)
|
||||
|
||||
|
|
@ -156,6 +157,10 @@ def load_admin_web_server_enabled(config):
|
|||
return config["webadmin"].getboolean("enabled")
|
||||
|
||||
|
||||
def load_admin_web_server_use_ssl(config):
|
||||
return config["webadmin"].getboolean("use_ssl")
|
||||
|
||||
|
||||
def start_admin_web_server(admin_web_server):
|
||||
logger.info("Calling start_admin_web_server...")
|
||||
thread = threading.Thread(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue