Edit this page | Blame

Coupling current_app and db_utils

Tags

  • assigned: fredm, aruni
  • priority: high
  • type: bug
  • status: closed, completed, fixed
  • keywords: bug, configurations

Description

couples current_app into db_utils

db_utils is used in other scripts, such as `scripts/index-genenetwork` which are (arguably) not supposed to be aware of the application, which leads to

Unfortunately, the naive fix of simply reverting to using the configuration variable `SQL_URI` could lead to configuration differences between the application and the scripts that would rely on the gn3.settings.SQL_URI variable. This is due to

that sets up the application configuration.

We start off with

which could then

by any settings provided via the `GN3_CONF` variable.

The issue here is that the value in `gn3.settings` can be fetched from the shell environment variables, overwriting any default value in `gn3.settings` but that can then be overwritten by `GN3_CONF`. This implies that we need a more traceable configuration system.

The scripts that use the same configuration values as the application should probably be run as **flask CLI** commands, or have the configuration variable(s) provided to the script(s) directly via the CLI.

Fix: Provide URI on the CLI

Commits attempting to fix the issue

finally decouples `gn3.db_utils` completely from `flask.current_app` and makes the `sql_uri` argument mandatory.

(made with skribilo)