Persist data in default directory
Use directories crate to persist config.toml and potentially the DB for #63 in a standard location. Handle situation where more than one app is run
You mean dirs? I think this should be optional and consumers should be able to plug their own db.
I meant directories based on bitmask's config setup suggestion from @cryptoquick.
twas past my bedtime when I drafted the atrocity of the original issue text
Ah, OK, dirs is almost the same and should be sufficient but I may be missing something. But thinking about it more this makes less and less sense.
- Needs to have a unique name to not collide with other stuff
- What if the consumer already uses a db? This would add another dependency.
- Needs to also accept project name
- Might need to create the directory but so may the rest of the application and perhaps it will want to set some permissions or detect first-run situation.
- Generally feels out-of scope
I think two things are being conflated
- the topic of this issue data persistence / configuration folder for
payjoin-cli. This could go in a .payjoin folder at the default app location. Right now the config file is called from wherever the binary is invoked. An alternative could be to pass config path via cli. - A receiver saving inputs that have been seen. Right now this is done KISS by serializing a
HashSetto a file calledinputs_seen.jsonagain, wherever the binary is invoked. Uri already usesserde, and I don't see that dependency as additional or going anywhere anytime soon.
Having a proper DB would definitely be better, but I don't want to overoptimize before user demand. In the worst case we could migrate the HashSet to a more robust / performant DB later. This issue is separate to the one of keeping data organized in a payjoin-cli specific data folder
Ah, this is about cli, not library, it makes sense then. Originally CLI was intended as PoC but it could be nice to develop it further. In that case I totally agree it should be stored in a DB. I have experience with rusqlite which works fine but has a bit annoying MSRV.
This was closed by https://github.com/payjoin/rust-payjoin/pull/281/files which added a proper DB and the option to set a custom DB path as an option.
My concern with this issue is when people cargo install payjoin-cli the behavior changes depending on which directory they call the program in. Using a default directory and only using an alternative with a manual configuration argument would fix this problem