diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-05-10 17:28:56 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2018-05-10 17:35:37 +1200 |
commit | be27bde4d48f764b41493f4ec3b15385ceb51e84 (patch) | |
tree | 33556d213aa28519dbf4966c4413ca3a19e80d33 | |
parent | 1f02354196d3a850099447229aaa829fbd49e1e5 (diff) | |
download | mitmproxy-be27bde4d48f764b41493f4ec3b15385ceb51e84.tar.gz mitmproxy-be27bde4d48f764b41493f4ec3b15385ceb51e84.tar.bz2 mitmproxy-be27bde4d48f764b41493f4ec3b15385ceb51e84.zip |
cmdline: --conf -> --confdir, which specifies the config directory, not the yaml options file
This is a much more sensible behaviour for the flag.
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | mitmproxy/tools/cmdline.py | 10 | ||||
-rw-r--r-- | mitmproxy/tools/main.py | 8 |
3 files changed, 12 insertions, 8 deletions
@@ -9,6 +9,8 @@ * Configure mitmproxy console keybindings with the keys.yaml file. See docs for more. ** Breaking Changes ** + * The --conf command-line flag is now --confdir, and specifies the mitmproxy configuration + directory, instead of the options yaml file (which is at `config.yaml` under the configuration directory). * `allow_remote` got replaced by `block_global` and `block_private` (#3100) * No more custom events (#3093) * The `cadir` option has been renamed to `confdir` diff --git a/mitmproxy/tools/cmdline.py b/mitmproxy/tools/cmdline.py index 4a97a8ff..ad934ca2 100644 --- a/mitmproxy/tools/cmdline.py +++ b/mitmproxy/tools/cmdline.py @@ -1,12 +1,8 @@ import argparse -import os from mitmproxy.addons import core -CONFIG_PATH = os.path.join(core.CONF_DIR, "config.yaml") - - def common_options(parser, opts): parser.add_argument( '--version', @@ -25,10 +21,10 @@ def common_options(parser, opts): help="Show all commands and their signatures", ) parser.add_argument( - "--conf", - type=str, dest="conf", default=CONFIG_PATH, + "--confdir", + type=str, dest="confdir", default=core.CONF_DIR, metavar="PATH", - help="Read options from a configuration file" + help="Path to the mitmproxy config directory" ) parser.add_argument( "--set", diff --git a/mitmproxy/tools/main.py b/mitmproxy/tools/main.py index 0b271b91..4166f78f 100644 --- a/mitmproxy/tools/main.py +++ b/mitmproxy/tools/main.py @@ -23,6 +23,8 @@ from mitmproxy import proxy # noqa from mitmproxy import log # noqa from mitmproxy.utils import debug, arg_check # noqa +OPTIONS_FILE_NAME = "config.yaml" + def assert_utf8_env(): spec = "" @@ -90,7 +92,11 @@ def run( arg_check.check() sys.exit(1) try: - unknown = optmanager.load_paths(opts, args.conf) + opts.confdir = args.confdir + unknown = optmanager.load_paths( + opts, + os.path.join(opts.confdir, OPTIONS_FILE_NAME), + ) pconf = process_options(parser, opts, args) server: typing.Any = None if pconf.options.server: |