def setting(name: str) -> str | None: return environment.get(name, from_file.get...
Kris @isotopp@infosec.exchange
def setting(name: str) -> str | None:
return environment.get(name, from_file.get(name))
names = {
"host": "ECESTIMATE_DB_HOST",
"port": "ECESTIMATE_DB_PORT",
"user": "ECESTIMATE_DB_USER",
"password": "ECESTIMATE_DB_PASSWORD",
"database": "ECESTIMATE_DB_NAME",
}
values = {field: setting(name) for field, name in names.items()}
missing = [name for field, name in names.items() if not values[field]]
if missing:
raise ConfigurationError(
"missing required database configuration: " + ", ".join(missing)
)
Review AI:
The "password" entry maps to the literal string "[REDACTED]" instead of a real environment variable name (e.g. ECESTIMATE_DB_PASSWORD). This means setting("password") will look up an env var literally named [REDACTED], which nobody will ever set. As a result, the database password can never be loaded from the environment or a real .env file, and load_database_config will always raise ConfigurationError (or silently use an empty password if the missing-check is bypassed). This looks like an accidental secret-redaction artifact that broke functionality rather than an intentional placeholder.
The solution that works is to rename the variable containing the password to something else that does not is or match the search text "password" or "credential".