Environment variable configuration should take precedence over database settings
#5626 opened on Oct 18, 2021
Description
Right now, if settings are introduced that are configurable by environment variables, they will be ignored in favour of configured database settings.
This is because the organization model prefers to get its settings from the database (short circuit): https://github.com/getredash/redash/blob/143d22db04a9058966b8c7d678b06f228b937326/redash/models/organizations.py#L69
and there is no mechanism to synchronize database settings with detected environment variables, even if they are initially loaded via https://github.com/getredash/redash/blob/master/redash/settings/organization.py .
I would like to suggest that environment variables, when present, should be preferred over prior DB stored settings, as they should always be assumed to have been most recently provided as the desired configuration versus anything that may have been previously configured and persisted.
This matches the typical behaviour of many other software, where command-line arguments or envars always take precedence over local files.