diff --git a/tutorials/a-simple-walkthrough/astre.py b/tutorials/a-simple-walkthrough/astre.py index 729692b..234cce5 100644 --- a/tutorials/a-simple-walkthrough/astre.py +++ b/tutorials/a-simple-walkthrough/astre.py @@ -43,10 +43,11 @@ def run(): cherrypy.config.update({ "environment": "production", "log.screen": True, + "server.socket_host": "0.0.0.0", "server.socket_port": 8444, "server.ssl_module": "builtin", - "server.ssl_private_key": os.path.join(cur_dir, "key.pem"), - "server.ssl_certificate": os.path.join(cur_dir, "cert.pem") + "server.ssl_private_key": os.path.join(cur_dir, os.environ.get("SSL_KEY", "key.pem")), + "server.ssl_certificate": os.path.join(cur_dir, os.environ.get("SSL_CRT","cert.pem")) }) PIDFile(cherrypy.engine, 'astre.pid').subscribe() cherrypy.quickstart(Root()) diff --git a/tutorials/a-simple-walkthrough/sunset.py b/tutorials/a-simple-walkthrough/sunset.py index adbf86e..dba1684 100644 --- a/tutorials/a-simple-walkthrough/sunset.py +++ b/tutorials/a-simple-walkthrough/sunset.py @@ -5,16 +5,17 @@ import requests cur_dir = os.path.abspath(os.path.dirname(__file__)) -key_path = os.path.join(cur_dir, "key.pem") -cert_path = os.path.join(cur_dir, "cert.pem") - +key_path = os.path.join(cur_dir, os.environ.get("SSL_KEY", "key.pem")) +cert_path = os.path.join(cur_dir, os.environ.get("SSL_CRT", "cert.pem")) +astre_svc = os.environ.get("ASTRE_SERVICE", "localhost") +astre_cert_path = os.environ.get("ASTRE_SSL_CRT", "cert.pem") class Root: @cherrypy.expose def city(self, name): - r = requests.post("https://localhost:8444/", timeout=(2, 2), json={ + r = requests.post("https://{}:8444/".format(astre_svc), timeout=(2, 2), json={ "city": name - }, verify=cert_path) + }, verify=astre_cert_path) if r.status_code != 200: raise cherrypy.HTTPError(500, r.text) @@ -30,6 +31,7 @@ def run(): cherrypy.config.update({ "environment": "production", "log.screen": True, + "server.socket_host": "0.0.0.0", "server.socket_port": 8443, "server.ssl_module": "builtin", "server.ssl_private_key": key_path,