Add walking up parent directories when loading dotenv files#4147
Add walking up parent directories when loading dotenv files#4147revolter wants to merge 5 commits into
Conversation
It is used to load the dotenv file.
Previously, only a `.env` file next to the database was checked. Now parent directories are searched until a matching password entry is found. Related-to: 3cdc65a
There was a problem hiding this comment.
Pull request overview
This PR enhances the SQLCipher “dotenv” auto-unlock flow by extending the .env lookup beyond the database’s directory: it now walks up parent directories until it finds a matching password entry for the database filename. This builds on the earlier dotenv-based encrypted DB opening work referenced in PR #1404.
Changes:
- Add
QSettingsinclude to support reading.envfiles. - Replace single-directory
.envlookup with a parent-directory search loop, stopping once a matching password entry is found.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @revolter, At least, I think this behaviour should be opt-in through a setting in the preferences' dialog. |
|
Hi @mgrojo,
Ish. I have some encrypted databases in an iOS app, and running it in the Simulator places the databases in a deeply nested location under
True, good catch! I now realize that other tools with a similar feature have their own custom naming for these files (they're also configs, not secret holders).
Makes sense! But, with the above, what do you think of searching for |
|
While I understand the use case here as well, I do not think that this is the right approach. Especially with deeply nested file hierarchies, this is some unnecessary overhead, apart from the fact that at some level the permissions might not even be available anymore. For this use case, it seems like letting the environment load the |
Previously, only a
.envfile next to the database was checked.Now parent directories are searched until a matching password entry
is found.
Related-to: 3cdc65a (#1404).