getredash/redash

Environment variable configuration should take precedence over database settings

Open

#5626 aperta il 18 ott 2021

Vedi su GitHub
 (0 commenti) (3 reazioni) (0 assegnatari)Python (4236 fork)batch import
Backendhelp wanted

Metriche repository

Star
 (24.845 star)
Metriche merge PR
 (Merge medio 9g 5h) (3 PR mergiate in 30 g)

Descrizione

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.

Guida contributor