openbmc / bmcweb

A do everything Redfish, KVM, GUI, and DBus webserver for OpenBMC
Apache License 2.0
154 stars 131 forks source link

BMCWEB has several non-const global variables #185

Open edtanous opened 3 years ago

edtanous commented 3 years ago

bmcweb as a design goal should try to have no non-const global variables. Most of these variables can be thought of as general application state, and should be put in the App object. We used global variables initially because we didn't have access to modify the App object, as it was a template that individual callers didn't have access to without also being a template.

But times have changed, and that issue has been fixed, so we can now just directly call to and from app when making our requests. One such example of a non-const, nontrivial global variable is in the websocket monitor class: https://github.com/openbmc/bmcweb/blob/65f7365901fad2437456f4edcdac41e03f0ca259/include/dbus_monitor.hpp#L25