earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
623 stars 18 forks source link

ExtensionKnownShares loading known shares from memory #332

Closed michielbdejong closed 1 month ago

michielbdejong commented 1 month ago

This is strictly a nice-to-have, but maybe worth documenting anyway:

In my code I need to dynamically start an Earthstar Server for a number of shares, whose names I cannot predict at build time. I ended up saving the share names to a file at runtime, and then adding the name of that file as knownSharesPath but it's currently the only reason I need to give deno --allow-read and --allow-write, so would be nice if I could pass the known shares as a JavaScript array instead.

sgwilym commented 1 month ago

Yeah, that would be an improvement. The next version of Earthstar (which is now getting closer) will let you set the known shares directly on the Peer using capabilities, and then you can pass that peer into the server constructor.