tursodatabase / libsql-client-rs

libSQL Rust client library can be used to communicate with sqld natively over HTTP protocol with native Rust interface.
MIT License
75 stars 27 forks source link

libsql:// defaults to HTTPS #53

Open lypanov opened 10 months ago

lypanov commented 10 months ago

Unlike http:// libsql:// defaults to HTTPS. This doesn't seem quite right honestly and made for a poor first impression during my getting started tutorial.

NFuller721 commented 6 months ago

I had this same issue. I am using the extensions that were provided via "libsql", and I couldn't use it over "http". I solved it by forking "libsql-client-rs" and changing "https://" to "http://" on line 296 in "src/client.rs". There are of course better ways to write this, but this will work for local development. I also had to spin my own sqld server which was quite simple actually.

I ran the commands:

brew tap libsql/sqld brew install sqld

Then copied sqlean's uuid and math precompiled binaries, and added the "sha256sum" of both to a file called trusted.lst in a folder called "extensions" that also included those binaries. Then I ran the command:

sqld -e ~/path/to/extensions

And that should be it!

NFuller721 commented 6 months ago

I would like to revise my answer and say that you do not have to fork "libsql-client-rs". You can just set your LIBSQL_CLIENT_URL to http instead of libsql. I may be wrong about this, but from the way I understand the code in client.rs it just takes "libsql://" and replaces it with "https://" and does nothing special.