From 836e04abd6b39390bbe9112095b81b4eee74c610 Mon Sep 17 00:00:00 2001 From: Yoann L Date: Thu, 14 Nov 2019 18:39:06 +0100 Subject: adding config.yml as an allowed config filename cf. title as suggested in #3639 --- mitmproxy/tools/_main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mitmproxy/tools/_main.py b/mitmproxy/tools/_main.py index 8a98278d..bcec7327 100644 --- a/mitmproxy/tools/_main.py +++ b/mitmproxy/tools/_main.py @@ -17,8 +17,6 @@ from mitmproxy import optmanager from mitmproxy import proxy from mitmproxy.utils import debug, arg_check -OPTIONS_FILE_NAME = "config.yaml" - def assert_utf8_env(): spec = "" @@ -69,6 +67,8 @@ def run( options. """ debug.register_info_dumpers() + # Be tolerant as the yml is often recommended + OPTIONS_FILE_NAMES = ["config.yaml", "config.yml"] opts = options.Options() master = master_cls(opts) @@ -87,10 +87,11 @@ def run( sys.exit(1) try: opts.set(*args.setoptions, defer=True) - optmanager.load_paths( - opts, - os.path.join(opts.confdir, OPTIONS_FILE_NAME), - ) + for conf_file in OPTIONS_FILE_NAMES: + optmanager.load_paths( + opts, + os.path.join(opts.confdir, conf_file), + ) pconf = process_options(parser, opts, args) server: typing.Any = None if pconf.options.server: -- cgit v1.2.3