DarkflameUniverse / NexusDashboard

Dashboard for Complete Management of a DLU game server
GNU Affero General Public License v3.0
47 stars 7 forks source link

Improve os.getenv #89

Open Xiphoseer opened 10 months ago

Xiphoseer commented 10 months ago

Currently there are a bunch of lines like https://github.com/DarkflameUniverse/NexusDashboard/blob/2e4bd04d09d78cd7e6fbf68eebd7c49cf55a85c3/app/__init__.py#L233-L236 in app/__init__.py

Given that os.getenv returns either the default or a string and

$ python3
>>> bool("")
False
>>> bool("1")
True
>>> bool("0")
True
>>> bool("True")
True
>>> bool("False")
True

this may not be the best way to parse boolean type values, because an if on just the value may cause unituitive configuration.