Redact by default (#1376)

This commit is contained in:
Adrian Sampson 2015-03-29 14:26:16 -07:00
parent e7bba32a44
commit c37561c74b
4 changed files with 13 additions and 13 deletions

View file

@ -1507,8 +1507,9 @@ config_cmd.parser.add_option(
help='include the default configuration'
)
config_cmd.parser.add_option(
'-r', '--redact', action='store_true',
help='redact sensitive fields'
'-c', '--clear', action='store_false',
dest='redact', default=True,
help='do not redact sensitive fields'
)
config_cmd.func = config_func
default_commands.append(config_cmd)

View file

@ -66,9 +66,9 @@ Features:
flexible attribute `data_source` of an Item/Album. :bug:`1311`
* :doc:`/plugins/permissions`: Now handles also the permissions of the
directories. :bug:`1308` :bug:`1324`
* In the :ref:`config-cmd` command, a new option ``-r/--redact`` will
automatically redact sensitive values (e.g., passwords) when printing the
config. :bug:`1376`
* In the :ref:`config-cmd` command, the output is now redacted by default.
Sensitive information like passwords and API keys is not included. The new
``--clear`` option disables redaction. :bug:`1376`
* :doc:`/plugins/ftintitle`: You can now configure the format that the plugin
uses to add the artist to the title. Thanks to :user:`amishb`. :bug:`1377`

View file

@ -340,7 +340,7 @@ config
``````
::
beet config [-pdr]
beet config [-pdc]
beet config -e
Show or edit the user configuration. This command does one of three things:
@ -351,9 +351,8 @@ Show or edit the user configuration. This command does one of three things:
* The ``--path`` option instead shows the path to your configuration file.
This can be combined with the ``--default`` flag to show where beets keeps
its internal defaults.
* The ``--redact`` option will automatically mask sensitive values (e.g.,
passwords) when printing the configuration. This makes it easier to
copy/paste your config when reporting bugs.
* By default, sensitive information like passwords is removed when dumping the
configuration. The ``--clear`` option includes this sensitive data.
* With the ``--edit`` option, beets attempts to open your config file for
editing. It first tries the ``$EDITOR`` environment variable and then a
fallback option depending on your platform: ``open`` on OS X, ``xdg-open``

View file

@ -42,14 +42,14 @@ class ConfigCommandTest(unittest.TestCase, TestHelper):
def test_show_user_config(self):
with capture_stdout() as output:
self.run_command('config')
self.run_command('config', '-c')
output = yaml.load(output.getvalue())
self.assertEqual(output['option'], 'value')
self.assertEqual(output['password'], 'password_value')
def test_show_user_config_with_defaults(self):
with capture_stdout() as output:
self.run_command('config', '-d')
self.run_command('config', '-dc')
output = yaml.load(output.getvalue())
self.assertEqual(output['option'], 'value')
self.assertEqual(output['password'], 'password_value')
@ -65,14 +65,14 @@ class ConfigCommandTest(unittest.TestCase, TestHelper):
def test_show_redacted_user_config(self):
with capture_stdout() as output:
self.run_command('config', '-r')
self.run_command('config')
output = yaml.load(output.getvalue())
self.assertEqual(output['option'], 'value')
self.assertEqual(output['password'], 'REDACTED')
def test_show_redacted_user_config_with_defaults(self):
with capture_stdout() as output:
self.run_command('config', '-rd')
self.run_command('config', '-d')
output = yaml.load(output.getvalue())
self.assertEqual(output['option'], 'value')
self.assertEqual(output['password'], 'REDACTED')