commit 319f1348f28a226f287b96ea3f1f2e698612b8b3 Author: Damian Johnson atagar@torproject.org Date: Wed Oct 28 17:10:35 2020 -0700
Replace references to a nyxrc
Back in our old 'arm' days users could configure us through a file at ~/.armrc. Nyx changed this location to ~/.nyx/config but continued to call it a 'nyxrc'. Caught thanks to Sai...
https://github.com/torproject/nyx/pull/27
Mostly this changes internal references, but there are two user visible changes...
* This fixes our FAQ which incorrectly said that we read from ~/.nyx/nyxrc.
* Removes the sample nyxrc path from our man page. Our setup.py no longer installs such a file.
This intentionally keeps two references to a nyxrc...
* Our website's url for a sample is...
https://nyx.torproject.org/nyxrc.sample
We can't change this prior to our next release without confusing users.
* Our legacy changelog entries still call it a nyxrc because that's what it was called back then. --- nyx.1 | 4 ---- nyx/panel/torrc.py | 5 ++--- nyx/starter.py | 24 +++++++++++++----------- test/panel/log.py | 14 +++++++------- web/index.html | 36 ++++++++++++++++++------------------ web/styles.css | 10 +++++----- 6 files changed, 45 insertions(+), 48 deletions(-)
diff --git a/nyx.1 b/nyx.1 index f779372..95e8df6 100644 --- a/nyx.1 +++ b/nyx.1 @@ -56,10 +56,6 @@ provides usage information \fB~/.nyx/config\fR Your personal nyx configuration file
-.TP -\fB/usr/share/doc/nyx/nyxrc.sample\fR -Sample nyxrc configuration file that documents all options - .SH AUTHOR Written by Damian Johnson (atagar@torproject.org)
diff --git a/nyx/panel/torrc.py b/nyx/panel/torrc.py index 8f4a530..5efa2d4 100644 --- a/nyx/panel/torrc.py +++ b/nyx/panel/torrc.py @@ -2,7 +2,7 @@ # See LICENSE for licensing information
""" -Panel displaying the torrc or nyxrc with the validation done against it. +Panel displays our syntax highlighted torrc. """
import functools @@ -32,8 +32,7 @@ def _read_torrc(path):
class TorrcPanel(panel.Panel): """ - Renders the current torrc or nyxrc with syntax highlighting in a scrollable - area. + Renders our syntax highlighted torrc within a scrollable area. """
def __init__(self): diff --git a/nyx/starter.py b/nyx/starter.py index be904fd..547ba5c 100644 --- a/nyx/starter.py +++ b/nyx/starter.py @@ -32,8 +32,8 @@ Stem Version: {stem_version} Python Version: {python_version} Platform: {system} -------------------------------------------------------------------------------- -Nyx Configuration ({nyxrc_path}): -{nyxrc_content} +Nyx Configuration ({nyx_config_path}): +{nyx_config_content} -------------------------------------------------------------------------------- """.strip()
@@ -77,9 +77,11 @@ def main(config): except IOError as exc: stem.util.log.warn('Failed to load configuration (using defaults): "%s"' % exc.strerror) else: - stem.util.log.notice('No nyxrc loaded, using defaults. You can customize nyx by placing a configuration file at %s (see https://nyx.torproject.org/nyxrc.sample for its options).' % args.config) + # TODO: move this url to 'nyx_config.sample' when we're about to issue another release
- # If a password is provided via the user's nyxrc that will be use, otherwise + stem.util.log.notice('No nyx configuration loaded, using defaults. You can customize nyx by placing a configuration file at %s (see https://nyx.torproject.org/nyxrc.sample for its options).' % args.config) + + # If a password is provided via the user's nyx configuration that will be use, otherwise # users are prompted for a password if required.
controller_password = config.get('password', None) @@ -156,22 +158,22 @@ def _setup_debug_logging(args): logger = stem.util.log.get_logger() logger.addHandler(debug_handler)
- nyxrc_content = "[file doesn't exist]" + nyx_config_content = "[file doesn't exist]"
if os.path.exists(args.config): try: - with open(args.config) as nyxrc_file: - nyxrc_content = nyxrc_file.read() + with open(args.config) as nyx_config_file: + nyx_config_content = nyx_config_file.read() except IOError as exc: - nyxrc_content = '[unable to read file: %s]' % exc.strerror + nyx_config_content = '[unable to read file: %s]' % exc.strerror
stem.util.log.trace(DEBUG_HEADER.format( nyx_version = nyx.__version__, stem_version = stem.__version__, python_version = '.'.join(map(str, sys.version_info[:3])), system = platform.system(), - nyxrc_path = args.config, - nyxrc_content = nyxrc_content, + nyx_config_path = args.config, + nyx_config_content = nyx_config_content, ))
@@ -201,7 +203,7 @@ def _warn_if_unable_to_get_pid(controller): @uses_settings def _warn_about_unused_config_keys(config): """ - Provides a notice if the user's nyxrc has any entries that are unused. + Provides a notice if the user's nyx configuration has any entries that are unused. """
for key in sorted(config.unused_keys()): diff --git a/test/panel/log.py b/test/panel/log.py index a05ed4f..bb27ef7 100644 --- a/test/panel/log.py +++ b/test/panel/log.py @@ -25,9 +25,9 @@ EXPECTED_WRAPPED_MSG = """\
EXPECTED_ENTRIES = """\ 16:41:37 [NYX_WARNING] Tor's geoip database is unavailable. - 16:41:37 [NYX_NOTICE] No nyxrc loaded, using defaults. You can customize nyx by - placing a configuration file at /home/atagar/.nyx/nyxrc (see the nyxrc.sample - for its options). + 16:41:37 [NYX_NOTICE] No nyx configuration loaded, using defaults. You can + customize nyx by placing a configuration file at /home/atagar/.nyx/config + (see https://nyx.torproject.org/nyxrc.sample for its options). 16:41:37 [NOTICE] New control connection opened from 127.0.0.1. 16:41:37 [NOTICE] Opening OR listener on 0.0.0.0:7000 16:41:37 [NOTICE] Opening Control listener on 127.0.0.1:9051 @@ -41,9 +41,9 @@ EXPECTED_ENTRIES = """\ EXPECTED_ENTRIES_WITH_BORDER = """\ +-October 26, 2011-------------------------------------------------------------+ |16:41:37 [NYX_WARNING] Tor's geoip database is unavailable. | -|16:41:37 [NYX_NOTICE] No nyxrc loaded, using defaults. You can customize nyx | -| by placing a configuration file at /home/atagar/.nyx/nyxrc (see the | -| nyxrc.sample for its options). | +|16:41:37 [NYX_NOTICE] No nyx configuration loaded, using defaults. You can | +| customize nyx by placing a configuration file at /home/atagar/.nyx/config | +| (see https://nyx.torproject.org/nyxrc.sample for its options). | |16:41:37 [NOTICE] New control connection opened from 127.0.0.1. | |16:41:37 [NOTICE] Opening OR listener on 0.0.0.0:7000 | |16:41:37 [NOTICE] Opening Control listener on 127.0.0.1:9051 | @@ -62,7 +62,7 @@ TIME_STRUCT = time.gmtime(NOW) def entries(): return [ LogEntry(NOW, 'NYX_WARNING', "Tor's geoip database is unavailable."), - LogEntry(NOW, 'NYX_NOTICE', 'No nyxrc loaded, using defaults. You can customize nyx by placing a configuration file at /home/atagar/.nyx/nyxrc (see the nyxrc.sample for its options).'), + LogEntry(NOW, 'NYX_NOTICE', 'No nyx configuration loaded, using defaults. You can customize nyx by placing a configuration file at /home/atagar/.nyx/config (see https://nyx.torproject.org/nyxrc.sample for its options).'), LogEntry(NOW, 'NOTICE', 'New control connection opened from 127.0.0.1.'), LogEntry(NOW, 'NOTICE', 'Opening OR listener on 0.0.0.0:7000'), LogEntry(NOW, 'NOTICE', 'Opening Control listener on 127.0.0.1:9051'), diff --git a/web/index.html b/web/index.html index adfadb5..7ef511b 100644 --- a/web/index.html +++ b/web/index.html @@ -275,7 +275,7 @@ E: Unable to locate package nyx</pre> <span>Is bandwidth graphed in bits or bytes?</span> <div class="answer"> <p><b>Bytes</b>. Most tools measure in bytes so for consistency we do the same. Unfortunately hosting providers advertise in bits to inflate their numbers ("5 Mbit connection"). If graphs show just one eighth of what you expect this is why.</p> - <p>To graph in bits rather than bytes add the following to your <a href="#configuration">nyxrc</a>...</p> + <p>To graph in bits rather than bytes add the following to your <a href="#configuration">nyx configuration</a>...</p> <pre>show_bits true</pre> </div> </li> @@ -285,7 +285,7 @@ E: Unable to locate package nyx</pre> <div class="answer"> <a class="acs-img" href="images/screenshots/acs_failure.png"><img src="images/faq/acs_failure.png" alt="acs display failure"></a> <p>When alternate character support (ACS) <a href="http://invisible-island.net/ncurses/ncurses.faq.html#no_line_drawing">is unavailable</a> borders become characters like the picture above. This is a terminal bug.</p> - <p>Unfortunately there doesn't seem to be a way for Nyx to automatically detect this. However, when it happens this <b>can</b> be easily corrected. Simply run <i>reset</i>. To tell Nyx not to use ACS borders simply add the following to your <a href="#configuration">nyxrc</a>...</p> + <p>Unfortunately there doesn't seem to be a way for Nyx to automatically detect this. However, when it happens this <b>can</b> be easily corrected. Simply run <i>reset</i>. To tell Nyx not to use ACS borders simply add the following to your <a href="#configuration">nyx configuration</a>...</p> <pre>acs_support false</pre> </div> </li> @@ -487,18 +487,18 @@ sudo python setup.py install</pre><br></li> <div class="section"></div> <a href="#configuration" class="section-title">Configuration</a>
- <p>Like many terminal applications Nyx can be customized through a configuration file. By default <b>~/.nyx/nyxrc</b>, though you can specify one with <b>nyx --config /path/to/nyxrc</b>.</p> + <p>Like many terminal applications Nyx can be customized through a configuration file. By default <b>~/.nyx/configc</b>, though you can specify one with <b>nyx --config /path/to/nyx_config</b>.</p> <p>Configurations are a simple series of key/value pairs. <a href="https://stem.torproject.org/api/util/conf.html">See Stem</a> for details. For example...</p>
- <pre id="nyxrc-example"> + <pre id="nyx-config-example"> acs_support false color_override blue # make our UI predominately blue logged_events BW, NOTICE, WARN, ERR </pre>
- <h2 class="nyxrc-section">General Options</h2> + <h2 class="nyx-config-section">General Options</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> @@ -560,9 +560,9 @@ logged_events BW, NOTICE, WARN, ERR </tr> </table>
- <h2 class="nyxrc-section">Update Rates</h2> + <h2 class="nyx-config-section">Update Rates</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> @@ -594,9 +594,9 @@ logged_events BW, NOTICE, WARN, ERR </tr> </table>
- <h2 class="nyxrc-section">Logging</h2> + <h2 class="nyx-config-section">Logging</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> @@ -640,9 +640,9 @@ logged_events BW, NOTICE, WARN, ERR </tr> </table>
- <h2 class="nyxrc-section">Graphing</h2> + <h2 class="nyx-config-section">Graphing</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> @@ -704,9 +704,9 @@ logged_events BW, NOTICE, WARN, ERR </td> </table>
- <h2 class="nyxrc-section">Tor Configuration</h2> + <h2 class="nyx-config-section">Tor Configuration</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> @@ -744,9 +744,9 @@ logged_events BW, NOTICE, WARN, ERR </tr> </table>
- <h2 class="nyxrc-section">Connections</h2> + <h2 class="nyx-config-section">Connections</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> @@ -782,9 +782,9 @@ logged_events BW, NOTICE, WARN, ERR </tr> </table>
- <h2 class="nyxrc-section">Component Visibility</h2> + <h2 class="nyx-config-section">Component Visibility</h2>
- <table class="nyxrc-options"> + <table class="nyx-config-options"> <tr> <td width="125"><b>Option</b></td> <td width="100"><b>Default</b></td> diff --git a/web/styles.css b/web/styles.css index e412f17..68c8c84 100644 --- a/web/styles.css +++ b/web/styles.css @@ -327,26 +327,26 @@ Download Page Configuration Page ============================================================*/
-#nyxrc-example { +#nyx-config-example { text-align: left; }
-.nyxrc-section { +.nyx-config-section { margin-bottom: 10px; font-size: 23px; text-align: left; }
-.nyxrc-options { +.nyx-config-options { text-align: left; border-collapse: collapse; }
-.nyxrc-options table, th, td { +.nyx-config-options table, th, td { border: 1px solid #ccc; }
-.nyxrc-options td { +.nyx-config-options td { padding: 5px; vertical-align: top; }
tor-commits@lists.torproject.org