Browse Source

[serve] Upgrade to Jetforce v0.6.0

remotes/src/master
Natalie Pendragon 1 year ago
parent
commit
5d7627a3f2
  1. 773
      poetry.lock
  2. 2
      pyproject.toml
  3. 49
      serve/main.py

773
poetry.lock

File diff suppressed because it is too large

2
pyproject.toml

@ -9,7 +9,7 @@ license = "MIT"
python = "^3.7"
gusmobile = { git = "https://git.sr.ht/~natpen/gusmobile", branch = "np/gus-hack" }
whoosh = "^2.7.4"
jetforce = "^0.2.0"
jetforce = "^0"
jinja2 = "^2.11.2"
peewee = "^3.13.3"
feedparser = "^5.2.1"

49
serve/main.py

@ -1,23 +1,56 @@
import asyncio
import argparse
import jetforce
from . import app, gus
def main():
args = jetforce.command_line_parser().parse_args()
ssl_context = jetforce.make_ssl_context(
args.hostname, args.certfile, args.keyfile, args.cafile, args.capath
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--host",
help="Server address to bind to",
default="127.0.0.1"
)
parser.add_argument(
"--port",
help="Server port to bind to",
type=int,
default=1965
)
parser.add_argument(
"--hostname",
help="Server hostname",
default="localhost"
)
parser.add_argument(
"--tls-certfile",
dest="certfile",
help="Server TLS certificate file",
metavar="FILE",
)
parser.add_argument(
"--tls-keyfile",
dest="keyfile",
help="Server TLS private key file",
metavar="FILE",
)
return parser.parse_args()
def main():
args = parse_args()
server = jetforce.GeminiServer(
app=app,
host=args.host,
port=args.port,
ssl_context=ssl_context,
hostname=args.hostname,
app=app,
certfile=args.certfile,
keyfile=args.keyfile,
)
try:
asyncio.run(server.run())
server.run()
finally:
gus.searcher.close()

Loading…
Cancel
Save