mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
simplify option file loading
- no need for a constant that is only used once - if load_paths allows us to specify multiple paths, let's just do that.
This commit is contained in:
parent
836e04abd6
commit
c78165bd4c
@ -67,8 +67,6 @@ def run(
|
|||||||
options.
|
options.
|
||||||
"""
|
"""
|
||||||
debug.register_info_dumpers()
|
debug.register_info_dumpers()
|
||||||
# Be tolerant as the yml is often recommended
|
|
||||||
OPTIONS_FILE_NAMES = ["config.yaml", "config.yml"]
|
|
||||||
|
|
||||||
opts = options.Options()
|
opts = options.Options()
|
||||||
master = master_cls(opts)
|
master = master_cls(opts)
|
||||||
@ -87,11 +85,11 @@ def run(
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
try:
|
try:
|
||||||
opts.set(*args.setoptions, defer=True)
|
opts.set(*args.setoptions, defer=True)
|
||||||
for conf_file in OPTIONS_FILE_NAMES:
|
optmanager.load_paths(
|
||||||
optmanager.load_paths(
|
opts,
|
||||||
opts,
|
os.path.join(opts.confdir, "config.yaml"),
|
||||||
os.path.join(opts.confdir, conf_file),
|
os.path.join(opts.confdir, "config.yml"),
|
||||||
)
|
)
|
||||||
pconf = process_options(parser, opts, args)
|
pconf = process_options(parser, opts, args)
|
||||||
server: typing.Any = None
|
server: typing.Any = None
|
||||||
if pconf.options.server:
|
if pconf.options.server:
|
||||||
|
Loading…
Reference in New Issue
Block a user