feat(storage): support BLOGWATCHER_DB override#9
Open
maciej wants to merge 1 commit intoHyaxia:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Blogwatcher currently stores everything in a single
~/.blogwatcher/blogwatcher.db.That makes isolation between independent blog lists difficult and increases risk for broad operations like
read-all(including agent-driven usage), where one context can accidentally affect another.What changed
BLOGWATCHER_DBas a default DB path override.DefaultDBPath()now:BLOGWATCHER_DBwhen it is set to a non-empty value~/.blogwatcher/blogwatcher.dbwhen unset/emptyOpenDatabase("")still works across commands; it now resolves through the env-aware default path).Tests
TestDefaultDBPathUsesEnvOverrideTestDefaultDBPathFallsBackWhenEnvIsEmptygo test ./...Smoke test
Validated against:
Using isolated DB path:
BLOGWATCHER_DB=/tmp/blogwatcher-smoke.db ... add... scan... articles --allObserved 2 release entries (
v0.0.2,v0.0.1) stored in the isolated DB, and a separate DB path showed no shared articles.Backward compatibility
No breaking change: if
BLOGWATCHER_DBis not set (or empty), behavior remains unchanged.