From 65c8a6e47c2adb7a8fe574f9bb2fca8b41737663 Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Sat, 24 Aug 2019 18:37:13 -0400 Subject: [PATCH] Move the example files around for clarity --- README.md | 2 +- examples/{server_echo.py => echo_server.py} | 0 examples/{server_guestbook.py => guestbook.py} | 4 ++-- examples/{server_http_proxy.py => http_proxy.py} | 0 jetforce.py | 16 +++++++--------- 5 files changed, 10 insertions(+), 12 deletions(-) rename examples/{server_echo.py => echo_server.py} (100%) rename examples/{server_guestbook.py => guestbook.py} (95%) rename examples/{server_http_proxy.py => http_proxy.py} (100%) diff --git a/README.md b/README.md index f8b6d69..16c7e6d 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Jetforce will respond to any request containing a URL that don't match your host with a status of ``Proxy Request Refused``. Using python, you can modify this behavior to do fancy things like building a proxy -server for HTTP requests. See [server_http_proxy.py](examples/server_http_proxy.py) for +server for HTTP requests. See [http_proxy.py](examples/http_proxy.py) for an example of how to accomplish this. ### Serving Files diff --git a/examples/server_echo.py b/examples/echo_server.py similarity index 100% rename from examples/server_echo.py rename to examples/echo_server.py diff --git a/examples/server_guestbook.py b/examples/guestbook.py similarity index 95% rename from examples/server_guestbook.py rename to examples/guestbook.py index c55e058..f2539d6 100644 --- a/examples/server_guestbook.py +++ b/examples/guestbook.py @@ -15,9 +15,9 @@ guestbook = pathlib.Path("guestbook.txt") app = jetforce.JetforceApplication() -@app.route("$") +@app.route("") def index(request): - data = ["Guestbook", "=>/submit Leave a Message", ""] + data = ["Guestbook", "=>/submit Sign the Guestbook", ""] guestbook.touch(exist_ok=True) with guestbook.open("r") as fp: diff --git a/examples/server_http_proxy.py b/examples/http_proxy.py similarity index 100% rename from examples/server_http_proxy.py rename to examples/http_proxy.py diff --git a/jetforce.py b/jetforce.py index dc75879..46d7328 100755 --- a/jetforce.py +++ b/jetforce.py @@ -38,7 +38,7 @@ https://github.com/michael-lazar/jetforce EPILOG = """ If the TLS cert/keyfile is not provided, a self-signed certificate will -automatically be generated and saved to your temporary file directory. +automatically be generated and saved to your temporary directory. """ @@ -417,12 +417,12 @@ class GeminiServer: def __init__( self, - host: str, - port: int, - certfile: typing.Optional[str], - keyfile: typing.Optional[str], - hostname: str, app: typing.Callable, + host: str = "127.0.0.1", + port: int = 1965, + certfile: typing.Optional[str] = None, + keyfile: typing.Optional[str] = None, + hostname: str = "localhost", ) -> None: self.host = host @@ -525,9 +525,7 @@ def run_server() -> None: "--dir", help="Path on the filesystem to serve", default="/var/gemini" ) parser.add_argument( - "--index-file", - help="The gemini directory index file [i.e. index.html]", - default="index.gmi", + "--index-file", help="The gemini directory index file", default="index.gmi" ) args = parser.parse_args()