From bd1ab74031f3b589582848ffeb6361f3dbf6a630 Mon Sep 17 00:00:00 2001 From: LouisJackman Date: Thu, 23 Jan 2020 21:29:13 +0000 Subject: [PATCH] Add a devserver-global task for non-local dev testing The devserver target recently acquired a sane default of restricting access only to localhost. This is good for security. However, it can frustrate some usages like testing on phones on a local network or hosting the dev server within VMs (e.g. Docker for Mac) which see host OS browsers as not being 127.0.0.1. Add a new target called `devserver-global` for this case. As it's longer to type, the more svelte `devserver` will retain the more secure defaults that will suffice for most users; they can use the longer-to-type `devserver-global` target to relax the localhost-only restriction. --- pelican/tools/templates/Makefile.jinja2 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pelican/tools/templates/Makefile.jinja2 b/pelican/tools/templates/Makefile.jinja2 index 91b44320..0d27defd 100644 --- a/pelican/tools/templates/Makefile.jinja2 +++ b/pelican/tools/templates/Makefile.jinja2 @@ -114,6 +114,13 @@ else $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) endif +devserver-global: +ifdef PORT + $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -p $(PORT) -b 0.0.0.0 +else + $(PELICAN) -lr $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) -b 0.0.0.0 +endif + publish: $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)