Skip to content

Commit

Permalink
Process --enable-* flags before loading plugins (#860)
Browse files Browse the repository at this point in the history
* Process `--enable-*` flags before loading plugins

* Fix spelling

* Ignore RST299 and RST499
  • Loading branch information
abhinavsingh authored Dec 11, 2021
1 parent 57aa628 commit 808c7e4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ extend-ignore =
Q003 # FIXME: avoid escaping in-string quotes
RST201 # FIXME: missing trailing blank line in docstring
RST203 # FIXME: no trailing blank line in docstring
RST299 # FIXME: Cannot extract compound bibliographic field "copyright"
RST301 # FIXME: unexpected indent in docstring
RST499 # FIXME: Missing matching underline for section title overline
S101 # FIXME: assertions are thrown away in optimized mode, needs audit
S104 # FIXME: bind-all interface listen
S105 # FIXME: hardcoded password?
Expand Down
39 changes: 25 additions & 14 deletions proxy/common/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,30 @@ def initialize(
# unless user overrides the default auth plugin.
auth_plugins.append(auth_plugin)

# --enable flags must be parsed before loading plugins
# otherwise we will miss the plugins passed via constructor
args.enable_web_server = cast(
bool,
opts.get(
'enable_web_server',
args.enable_web_server,
),
)
args.enable_static_server = cast(
bool,
opts.get(
'enable_static_server',
args.enable_static_server,
),
)
args.enable_events = cast(
bool,
opts.get(
'enable_events',
args.enable_events,
),
)

# Load default plugins along with user provided --plugins
default_plugins = [
bytes_(p)
Expand Down Expand Up @@ -290,20 +314,14 @@ def initialize(
args.num_acceptors = cast(
int, num_acceptors if num_acceptors > 0 else multiprocessing.cpu_count(),
)

args.static_server_dir = cast(
str,
opts.get(
'static_server_dir',
args.static_server_dir,
),
)
args.enable_static_server = cast(
bool,
opts.get(
'enable_static_server',
args.enable_static_server,
),
)
args.min_compression_limit = cast(
bool,
opts.get(
Expand All @@ -324,13 +342,6 @@ def initialize(
args.timeout = cast(int, opts.get('timeout', args.timeout))
args.threadless = cast(bool, opts.get('threadless', args.threadless))
args.threaded = cast(bool, opts.get('threaded', args.threaded))
args.enable_events = cast(
bool,
opts.get(
'enable_events',
args.enable_events,
),
)
args.pid_file = cast(
Optional[str], opts.get(
'pid_file',
Expand Down

0 comments on commit 808c7e4

Please sign in to comment.