这是indexloc提供的服务,不要输入任何密码
Skip to content

Config file revamp #581

@tsroten

Description

@tsroten

In mycli, managing the config has been challenging for awhile since we have five places a user can configure their experience, three of which are config files.

  1. The ~/.my.cnf file ([client] section)
  2. The login path file, e.g. ~/.mylogin.cnf
  3. The mycli config file, ~/.myclirc
  4. The command-line arguments
  5. The commands in mycli

This issue documents the overall revamp of the config that we're trying to accomplish for version 2.

Tasks

  • Use CLI Helpers to read and validate the config files, see Add config file reading/writing cli_helpers#39
  • Store config files on macOS and Linux according to the XDG spec. Windows config files should be in a Windows-appropriate spot and not in the home folder.
  • Make config file options consistent across pgcli and mycli, see Consolidate config options pgcli#835
  • Add missing configuration options to mycli's config file, e.g. ssl, pager command, etc.
  • Add a migration tool that migrates config settings from .my.cnf and .mylogin.cnf to the mycli config file (allows user input to override this feature and control password migration)
  • Remove support for .my.cnf and .mylogin.cnf -- "one config file to rule them all"
  • Store log and audit log files according to the XDG spec.
  • Automatic config file permission checks -- warn or reject files that are group/world readable
  • Fix favorite query config file reading/writing: Favorite queries not loaded from or saved to config file #669

Missing options in mycli's config file to consider adding

These options are currently supported in mycli via the .my.cnf file, so we need to consider adding them to mycli's config file.

  • socket
  • default-character-set
  • ssl-ca
  • ssl-cert
  • ssl-key
  • ssl-cipher
  • ssl-mode
  • local-infile
  • pager (the command itself)

Assorted Background Notes

Previous config-related discussions:

The desire is to balance these three things well:

  1. Mycli's config is user-friendly
  2. Switching to mycli from MySQL is a seamless experience
  3. Mycli and pgcli have a consistent experience

There has been extensive discussion about the false sense of security that the encrypted login path file provides users. Many users have noted how it's not a security feature. In fact, if you have a copy of someone's login path file, you can decrypt it with a single command:
python -c 'from mycli.config import *;print(read_config_file(open_mylogin_cnf(get_mylogin_cnf_path())))'

Mycli now supports storing host/port/database information in its config file: http://www.mycli.net/loginpath#dsn

Another long-term goal is keyring support so that users can use their system's password manager with mycli.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions