mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-19 04:47:54 +00:00
Enable code live reload only in debug mode
This commit is contained in:
parent
c409819382
commit
1bfb201368
@ -82,7 +82,7 @@ def parse_arguments():
|
||||
parser.add_argument("-L", "--local", action="store_true", help="local mode (allow some insecure operations)")
|
||||
parser.add_argument("-A", "--allow", action="store_true", help="allow remote connections to local console ports")
|
||||
parser.add_argument("-q", "--quiet", action="store_true", help="do not show logs on stdout")
|
||||
parser.add_argument("-d", "--debug", action="store_true", help="show debug logs")
|
||||
parser.add_argument("-d", "--debug", action="store_true", help="show debug logs and enable code live reload")
|
||||
args = parser.parse_args()
|
||||
|
||||
config = Config.instance()
|
||||
@ -94,6 +94,7 @@ def parse_arguments():
|
||||
server_config["ssl"] = server_config.get("ssl", "true" if args.ssl else "false")
|
||||
server_config["certfile"] = server_config.get("certfile", args.certfile)
|
||||
server_config["certkey"] = server_config.get("certkey", args.certkey)
|
||||
server_config["debug"] = server_config.get("debug", "true" if args.debug else "false")
|
||||
config.set_section_config("Server", server_config)
|
||||
|
||||
return args
|
||||
|
@ -164,6 +164,7 @@ class Server:
|
||||
self._loop.run_until_complete(self._run_application(app, ssl_context))
|
||||
self._signal_handling()
|
||||
|
||||
# FIXME: remove it in production or in tests
|
||||
self._loop.call_later(1, self._reload_hook)
|
||||
if server_config["debug"] == "true":
|
||||
log.info("Code live reload is enabled, watching for file changes")
|
||||
self._loop.call_later(1, self._reload_hook)
|
||||
self._loop.run_forever()
|
||||
|
Loading…
Reference in New Issue
Block a user