add dev-mode
This commit is contained in:
parent
0803617e62
commit
31e1da937f
7 changed files with 146 additions and 51 deletions
|
|
@ -42,6 +42,11 @@ def parse_args(argv: list[str] | None = None) -> tuple[str, argparse.Namespace]:
|
|||
default=os.environ.get("REPUBLISHER_PORT", "8080"),
|
||||
help="Port for the web UI",
|
||||
)
|
||||
serve_parser.add_argument(
|
||||
"--dev-mode",
|
||||
action="store_true",
|
||||
help="Serve published feeds from /feeds for local development",
|
||||
)
|
||||
|
||||
crawl_parser = subparsers.add_parser("crawl", help="Run the feed crawler once")
|
||||
crawl_parser.add_argument(
|
||||
|
|
@ -51,11 +56,11 @@ def parse_args(argv: list[str] | None = None) -> tuple[str, argparse.Namespace]:
|
|||
help="Path to runtime config TOML file",
|
||||
)
|
||||
if not raw_args:
|
||||
raw_args = ["serve"]
|
||||
raw_args = ["serve", "--dev-mode"]
|
||||
elif raw_args[0] in {"-c", "--config"}:
|
||||
raw_args = ["crawl", *raw_args]
|
||||
elif raw_args[0] not in {"serve", "crawl"}:
|
||||
raw_args = ["serve", *raw_args]
|
||||
raw_args = ["serve", "--dev-mode", *raw_args]
|
||||
|
||||
args = parser.parse_args(raw_args)
|
||||
command = args.command or "serve"
|
||||
|
|
@ -75,7 +80,7 @@ def entrypoint(argv: list[str] | None = None) -> int:
|
|||
logger.error("Invalid REPUBLISHER_PORT/--port value: %s", args.port)
|
||||
return 2
|
||||
|
||||
app = create_app()
|
||||
app = create_app(dev_mode=bool(args.dev_mode))
|
||||
app.run(host=args.host, port=port)
|
||||
return 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue