diff --git a/changelog/67123.added.md b/changelog/67123.added.md new file mode 100644 index 000000000000..a31714bdba97 --- /dev/null +++ b/changelog/67123.added.md @@ -0,0 +1,6 @@ +Add options to inject arbitrary configuration into the CherryPy instance. + +Two new keys have been added under the "cherry\_py" master config. + +- "global" : corresponds to the "global" CherryPy config. +- "/" : corresponds to the "/" CherryPy config. diff --git a/salt/netapi/rest_cherrypy/app.py b/salt/netapi/rest_cherrypy/app.py index 57443796ffed..e4fe49f9d8d7 100644 --- a/salt/netapi/rest_cherrypy/app.py +++ b/salt/netapi/rest_cherrypy/app.py @@ -160,6 +160,17 @@ A URL path to the main entry point for the application. This is useful for serving multiple applications from the same URL. + global : ``{}`` + A dictionary of additional CherryPy "global" configuration. See the + CherryPy documentation for more information. + + .. versionadded:: 3008 + + / : ``{}`` + A dictionary of additional CherryPy "/" configuration. See the CherryPy + documentation for more information. + + .. versionadded:: 3008 .. _rest_cherrypy-auth: Authentication @@ -2931,6 +2942,9 @@ def get_conf(self): "tools.staticdir.dir": self.apiopts["static"], } + conf["global"].update(self.apiopts.get("global", {})) + conf["/"].update(self.apiopts.get("/", {})) + # Add to global config cherrypy.config.update(conf["global"])