Skip to content

Commit 08c19ee

Browse files
committed
feat: allow setting URL hostname with -H option to roundup-demo
The underlying demo.py code already supported this. Also update man page ading -H and fixing formatting for a number of entries. Clarify that hostname can be used with -B to listen on the ip address for that host. Refactor port handling to reduce line length.
1 parent 4404243 commit 08c19ee

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ Features:
186186
with the values from the dict. (John Rouillard)
187187
- add @group to rest interface collection queries. Useful when using
188188
optgroup in select elements. (John Rouillard)
189+
- roundup-demo can set the hostname in the URL using the -H
190+
parameter. So you can start a demo tracker that is available from
191+
your network using 'roundup-demo ... -B hostname -H hostname'. (John
192+
Rouillard)
189193

190194
2023-07-13 2.3.0
191195

roundup/scripts/roundup_demo.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,19 @@ def run():
7171
cli.add_argument('-B', '--bind_address',
7272
default="127.0.0.1",
7373
help=( "Choose address for server to listen at.\n"
74-
"Use 0.0.0.0 to bind to all addreses.\n"
74+
"Use 0.0.0.0 to bind to all addreses. Use\n"
75+
"the external name of the computer to bind to\n"
76+
"the external host interface.\n"
7577
"Default: %(default)s.\n\n"))
7678
cli.add_argument('-b', '--backend_db',
7779
choices=backends,
7880
help=( "Choose backend database. Default: %s.\n\n" %
7981
DEFAULT_BACKEND))
82+
cli.add_argument('-H', '--hostname',
83+
default="localhost",
84+
help=( "Choose hostname for the server.\n"
85+
"Default: %(default)s.\n\n"
86+
))
8087
cli.add_argument('-t', '--template',
8188
choices=templates,
8289
help="Use specified template. (*)\n\n")
@@ -87,8 +94,8 @@ def run():
8794
cli.add_argument('-P', '--urlport',
8895
type=int,
8996
help=( "Set docker external port. If using\n"
90-
" docker ... -p 9090:8917 ..."
91-
"this should be set to 9090. "
97+
" docker ... -p 9090:8917 ...\n"
98+
"this should be set to 9090.\n"
9299
"Default: as selected by --port\n\n"))
93100
cli.add_argument('-V', '--version', action='version',
94101
version='Roundup version %s'%roundup_version,
@@ -108,7 +115,8 @@ def run():
108115

109116
cli.add_argument('nuke', nargs='?', metavar='nuke', choices=['nuke'],
110117
help=( "The word 'nuke' will delete tracker and reset.\n"
111-
"E.G. %(prog)s -b sqlite -t classic ./mytracker nuke\n") % {"prog": sys.argv[0]})
118+
"E.G. %(prog)s -b sqlite \\ \n"
119+
"-t classic ./mytracker nuke\n") % {"prog": sys.argv[0]})
112120

113121
cli_args = cli.parse_args()
114122

@@ -168,9 +176,10 @@ def run():
168176
print("Unknown template: %s. Exiting." % template)
169177
exit(1)
170178
# install
179+
url_port = cli_args.urlport or cli_args.port or DEFAULT_PORT
171180
demo.install_demo(home, backend,
172181
admin.AdminTool().listTemplates()[template]['path'],
173-
use_port=cli_args.urlport or cli_args.port or DEFAULT_PORT)
182+
use_port=url_port, use_host=cli_args.hostname)
174183
else:
175184
# make sure that no options are specified that are only useful on initialization.
176185
if ( cli_args.backend or cli_args.template or

share/man/man1/roundup-demo.1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ tracker using the sqlite backend.
3333

3434
Show the help message and exit
3535
.TP
36-
\fB-b\fp \fIBIND_ADDRESS\fI, \fB--bind_address\fP \fIBIND_ADDRESS\fP
36+
\fB-B\fp \fIBIND_ADDRESS\fI, \fB--bind_address\fP \fIBIND_ADDRESS\fP
3737

3838
Choose address for server to listen at. Use 0.0.0.0 to bind to all addreses.
3939
Default: 127.0.0.1.
@@ -51,15 +51,21 @@ sqlite. Available backends are subject to availability on your system.
5151

5252
Use specified template when building tracker. (*)
5353
.TP
54+
\fB-h\fP \fIHOSTNAME\fP, \fB--hostname\fP \fIHOSTNAME\fP
55+
56+
Set the hostname used in the URL. This does not make the server listen
57+
at the hostname. Use the hostname with \fB-B\fP to listen on that IP
58+
address.
59+
.TP
5460
\fB-p\fP \fIPORT\fP, \fB--port\fP \fIPORT\fP
5561

5662
Listen at this port. Default: search for open port starting at 8917.
5763
.TP
58-
\fB-P\fP \fIURLPORT\fP, \fB--urlport\fP \fIURLPORT\fP When using
64+
\fB-P\fP \fIURLPORT\fP, \fB--urlport\fP \fIURLPORT\fP
5965

60-
docker this option passes the docker external port to the demo
61-
instance. If using \fBdocker ... -p 9090:8917 ...\fP this should be
62-
set to \fB-P 9090\fP. Default: as selected by \fB--port\fP.
66+
When using docker this option passes the docker external port to the
67+
demo instance. If using \fBdocker ... -p 9090:8917 ...\fP this should
68+
be set to \fB-P 9090\fP. Default: as selected by \fB--port\fP.
6369
.TP
6470
\fB-V\fP, \fB--version\fP
6571

0 commit comments

Comments
 (0)