Merge pull request #4 from jacobkiers/allow-specifying-listening-host

Allow setting the host parameter
This commit is contained in:
Soren Bjornstad 2022-03-14 21:01:35 -05:00 committed by GitHub
commit d3f6216837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -85,6 +85,12 @@ class ListenCommand(CliCommand):
@classmethod @classmethod
def setup_arguments(cls, parser: argparse.ArgumentParser) -> None: def setup_arguments(cls, parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--host",
metavar="HOST",
help="Host to listen on.",
default=str(cm().listen_host or "127.0.0.1"),
)
parser.add_argument( parser.add_argument(
"-p", "--port", "-p", "--port",
metavar="PORT", metavar="PORT",
@ -111,6 +117,7 @@ class ListenCommand(CliCommand):
tw.exec( tw.exec(
[ [
("listen", ("listen",
f"host={args.host}",
f"port={args.port}", f"port={args.port}",
f"username={args.username}", f"username={args.username}",
f"password={args.password}") f"password={args.password}")

View File

@ -35,6 +35,10 @@ commit_remote = ""
# http://localhost:8080 in your browser. # http://localhost:8080 in your browser.
listen_port = 8080 listen_port = 8080
# Host to listen on. If you specify "0.0.0.0" it will listen to all network interfaces.
# This is useful for allowing the wiki to be exposed to the network through a container.
listen_host = "127.0.0.1"
# Uncomment if you want to require HTTP basic authentication when serving your wiki. # Uncomment if you want to require HTTP basic authentication when serving your wiki.
# **WARNING**: this is NOT secure for use over the open Internet or all but the # **WARNING**: this is NOT secure for use over the open Internet or all but the
# simplest local networks, as the password is sent in the clear. For good # simplest local networks, as the password is sent in the clear. For good