server: hard-code --stats-file=stats.json

We already hard-code 'relay.sqlite', so I don't see a lot of value in
making making the stats file configurable too. That said, if it makes
life easier for packagers (e.g. start-stop-daemon or systemd wanting
these files to go into /var/run/something/ , and if it isn't sufficient
to just use /var/run/something/ as the CWD), I'd accept a patch to
add it back.
This commit is contained in:
Brian Warner 2016-06-26 17:40:18 -07:00
parent f005d8a9ce
commit 1d3b22a0b4
2 changed files with 3 additions and 13 deletions

View File

@ -48,13 +48,9 @@ def server(ctx):
"--signal-error", is_flag=True,
help="force all clients to fail with a message",
)
@click.option(
"--stats-file", default=None, type=type(u""), metavar="stats.json",
help="periodically write stats to a file for monitoring tools like Munin",
)
@click.pass_obj
def start(cfg, signal_error, no_daemon, blur_usage, advertise_version,
transit, rendezvous, stats_file):
transit, rendezvous):
"""
Start a relay server
"""
@ -65,7 +61,6 @@ def start(cfg, signal_error, no_daemon, blur_usage, advertise_version,
cfg.transit = str(transit)
cfg.rendezvous = str(rendezvous)
cfg.signal_error = signal_error
cfg.stats_file = stats_file
start_server(cfg)
@ -98,13 +93,9 @@ def start(cfg, signal_error, no_daemon, blur_usage, advertise_version,
"--signal-error", is_flag=True,
help="force all clients to fail with a message",
)
@click.option(
"--stats-file", default=None, type=type(u""), metavar="stats.json",
help="periodically write stats to a file for monitoring tools like Munin",
)
@click.pass_obj
def restart(cfg, signal_error, no_daemon, blur_usage, advertise_version,
transit, rendezvous, stats_file):
transit, rendezvous):
"""
Re-start a relay server
"""
@ -115,7 +106,6 @@ def restart(cfg, signal_error, no_daemon, blur_usage, advertise_version,
cfg.transit = str(transit)
cfg.rendezvous = str(rendezvous)
cfg.signal_error = signal_error
cfg.stats_file = stats_file
restart_server(cfg)

View File

@ -15,7 +15,7 @@ class MyPlugin:
self.args.advertise_version,
"relay.sqlite", self.args.blur_usage,
signal_error=self.args.signal_error,
stats_file=self.args.stats_file,
stats_file="stats.json",
)
class MyTwistdConfig(twistd.ServerOptions):