prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  WES ignores host in production
  When trying to run `toil server --host 0.0.0.0`, I noticed that it would always only listen on `127.0.0.1` no matter what `--host` is set to but running with `--debug` didn't have this problem.
  
  ```
  ❯ toil server --host 0.0.0.0
  ...
  [2022-11-11 16:50:46 +0000] [7173] [INFO] Starting gunicorn 20.1.0
  [2022-11-11 16:50:46 +0000] [7173] [INFO] Listening at: http://127.0.0.1:8000
  ...
  ```
  vs
  ```
  ❯ toil server --host 0.0.0.0 --debug
  ...
  INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
   * Running on all addresses (0.0.0.0)
   * Running on http://127.0.0.1:8080
  ...
  ```
  
  I tracked the problem down to [this line](https://github.com/DataBiosphere/toil/blob/master/src/toil/server/wsgi_app.py#L44). It appears to be overwriting the settings taken from the command line with Gunicorn's defaults before checking to see if anything has been set which `bind` won't be as it's been set to `None` in the merge.
  
  Swapping the dictionaries around seems to have fixed it.
  ```python
          for key, value in {**vars(env_args), **self.options}.items():
  ```
  
  ┆Issue is synchronized with this [Jira Story](https://ucsc-cgl.atlassian.net/browse/TOIL-1242)
  ┆Issue Number: TOIL-1242
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/toil/server/wsgi_app.py`
  Content:
  ```
  1 # Copyright (C) 2015-2021 Regents of the University of California
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 from typing import Any, Dict, Optional
  15 
  16 from gunicorn.app.base import BaseApplication  # type: ignore
  17 
  18 
  19 class GunicornApplication(BaseApplication):  # type: ignore
  20     """
  21     An entry point to integrate a Gunicorn WSGI server in Python. To start a
  22     WSGI application with callable `app`, run the following code:
  23 
  24         WSGIApplication(app, options={
  25             ...
  26         }).run()
  27 
  28     For more details, see: https://docs.gunicorn.org/en/latest/custom.html
  29     """
  30     def __init__(self, app: object, options: Optional[Dict[str, Any]] = None):
  31         self.options = options or {}
  32         self.application = app
  33         super().__init__()
  34 
  35     def init(self, *args: Any) -> None:
  36         pass
  37 
  38     def load_config(self) -> None:
  39         parser = self.cfg.parser()
  40         env_args = parser.parse_args(self.cfg.get_cmd_args_from_env())
  41 
  42         # TODO: also read from the Gunicorn config file?
  43 
  44         for key, value in {**self.options, **vars(env_args)}.items():
  45             if key in self.cfg.settings and value is not None:
  46                 self.cfg.set(key.lower(), value)
  47 
  48     def load(self) -> object:
  49         return self.application
  50 
  51 
  52 def run_app(app: object, options: Optional[Dict[str, Any]] = None) -> None:
  53     """
  54     Run a Gunicorn WSGI server.
  55     """
  56     GunicornApplication(app, options=options).run()
  57
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/toil/server/wsgi_app.py b/src/toil/server/wsgi_app.py
  --- a/src/toil/server/wsgi_app.py
  +++ b/src/toil/server/wsgi_app.py
  @@ -41,7 +41,7 @@
   
           # TODO: also read from the Gunicorn config file?
   
  -        for key, value in {**self.options, **vars(env_args)}.items():
  +        for key, value in {**vars(env_args), **self.options}.items():
               if key in self.cfg.settings and value is not None:
                   self.cfg.set(key.lower(), value)
  
verification_info: {"golden_diff": "diff --git a/src/toil/server/wsgi_app.py b/src/toil/server/wsgi_app.py\n--- a/src/toil/server/wsgi_app.py\n+++ b/src/toil/server/wsgi_app.py\n@@ -41,7 +41,7 @@\n \n         # TODO: also read from the Gunicorn config file?\n \n-        for key, value in {**self.options, **vars(env_args)}.items():\n+        for key, value in {**vars(env_args), **self.options}.items():\n             if key in self.cfg.settings and value is not None:\n                 self.cfg.set(key.lower(), value)\n", "issue": "WES ignores host in production\nWhen trying to run `toil server --host 0.0.0.0`, I noticed that it would always only listen on `127.0.0.1` no matter what `--host` is set to but running with `--debug` didn't have this problem.\n\n```\n\u276f toil server --host 0.0.0.0\n...\n[2022-11-11 16:50:46 +0000] [7173] [INFO] Starting gunicorn 20.1.0\n[2022-11-11 16:50:46 +0000] [7173] [INFO] Listening at: http://127.0.0.1:8000\n...\n```\nvs\n```\n\u276f toil server --host 0.0.0.0 --debug\n...\nINFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n * Running on all addresses (0.0.0.0)\n * Running on http://127.0.0.1:8080\n...\n```\n\nI tracked the problem down to [this line](https://github.com/DataBiosphere/toil/blob/master/src/toil/server/wsgi_app.py#L44). It appears to be overwriting the settings taken from the command line with Gunicorn's defaults before checking to see if anything has been set which `bind` won't be as it's been set to `None` in the merge.\n\nSwapping the dictionaries around seems to have fixed it.\n```python\n        for key, value in {**vars(env_args), **self.options}.items():\n```\n\n\u2506Issue is synchronized with this [Jira Story](https://ucsc-cgl.atlassian.net/browse/TOIL-1242)\n\u2506Issue Number: TOIL-1242\n\n", "before_files": [{"content": "# Copyright (C) 2015-2021 Regents of the University of California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom typing import Any, Dict, Optional\n\nfrom gunicorn.app.base import BaseApplication  # type: ignore\n\n\nclass GunicornApplication(BaseApplication):  # type: ignore\n    \"\"\"\n    An entry point to integrate a Gunicorn WSGI server in Python. To start a\n    WSGI application with callable `app`, run the following code:\n\n        WSGIApplication(app, options={\n            ...\n        }).run()\n\n    For more details, see: https://docs.gunicorn.org/en/latest/custom.html\n    \"\"\"\n    def __init__(self, app: object, options: Optional[Dict[str, Any]] = None):\n        self.options = options or {}\n        self.application = app\n        super().__init__()\n\n    def init(self, *args: Any) -> None:\n        pass\n\n    def load_config(self) -> None:\n        parser = self.cfg.parser()\n        env_args = parser.parse_args(self.cfg.get_cmd_args_from_env())\n\n        # TODO: also read from the Gunicorn config file?\n\n        for key, value in {**self.options, **vars(env_args)}.items():\n            if key in self.cfg.settings and value is not None:\n                self.cfg.set(key.lower(), value)\n\n    def load(self) -> object:\n        return self.application\n\n\ndef run_app(app: object, options: Optional[Dict[str, Any]] = None) -> None:\n    \"\"\"\n    Run a Gunicorn WSGI server.\n    \"\"\"\n    GunicornApplication(app, options=options).run()\n", "path": "src/toil/server/wsgi_app.py"}], "after_files": [{"content": "# Copyright (C) 2015-2021 Regents of the University of California\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nfrom typing import Any, Dict, Optional\n\nfrom gunicorn.app.base import BaseApplication  # type: ignore\n\n\nclass GunicornApplication(BaseApplication):  # type: ignore\n    \"\"\"\n    An entry point to integrate a Gunicorn WSGI server in Python. To start a\n    WSGI application with callable `app`, run the following code:\n\n        WSGIApplication(app, options={\n            ...\n        }).run()\n\n    For more details, see: https://docs.gunicorn.org/en/latest/custom.html\n    \"\"\"\n    def __init__(self, app: object, options: Optional[Dict[str, Any]] = None):\n        self.options = options or {}\n        self.application = app\n        super().__init__()\n\n    def init(self, *args: Any) -> None:\n        pass\n\n    def load_config(self) -> None:\n        parser = self.cfg.parser()\n        env_args = parser.parse_args(self.cfg.get_cmd_args_from_env())\n\n        # TODO: also read from the Gunicorn config file?\n\n        for key, value in {**vars(env_args), **self.options}.items():\n            if key in self.cfg.settings and value is not None:\n                self.cfg.set(key.lower(), value)\n\n    def load(self) -> object:\n        return self.application\n\n\ndef run_app(app: object, options: Optional[Dict[str, Any]] = None) -> None:\n    \"\"\"\n    Run a Gunicorn WSGI server.\n    \"\"\"\n    GunicornApplication(app, options=options).run()\n", "path": "src/toil/server/wsgi_app.py"}]}