-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Linux Support #78
Comments
I decided to take a crack at it here after realizing that it was probably just a missing
Some initial research tells me that |
@mergesort I believe this was fixed in #184. This can be closed, no? @brianmichel |
Yep, I think so! Thank you so much @brianmichel. 🙇🏻♂️ |
I'll make a new release with the Windows/Linux support soon. |
@mergesort the 2.2.1 release is out containing this feature, if you want to give it a try. |
@grdsdev Thanks a lot for the hard work! I'm trying to integrate Supabase on my server and not quite sure what values to provide for the My private lazy var client: SupabaseClient = {
#if os(Linux)
SupabaseClient(
supabaseURL: self.supabaseURL,
supabaseKey: self.apiKey,
options: SupabaseClientOptions(db: ..., auth: ..., global: ...)
)
#else
SupabaseClient(
supabaseURL: self.supabaseURL,
supabaseKey: self.apiKey
)
#endif
}() Is there a default implementation, or an example of what information I should be providing in a Vapor app that's looking to interface with Supabase? |
I ended up creating a dummy storage which looks like this. #if os(Linux)
private extension SupabaseController {
static let defaultOptions = SupabaseClientOptions(
db: SupabaseClientOptions.DatabaseOptions(),
auth: SupabaseClientOptions.AuthOptions(
storage: EmptyStorage()
),
global: SupabaseClientOptions.GlobalOptions()
)
}
private struct EmptyStorage: AuthLocalStorage {
func store(key: String, value: Data) throws {}
func retrieve(key: String) throws -> Data? { nil }
func remove(key: String) throws {}
}
#endif It seems to work but I wanted to make sure I wasn't doing anything wrong or unexpected, does that look right to you? |
Hi @mergesort The only required parameter for Linux is the The other options are all optional, you could use it to set up things like the default JSON encoder and decoder. Your private class MemoryStorage: AuthLocalStorage {
var storage: [String: Data] = [:]
func store(key: String, value: Data) throws {
storage[key] = value
}
func retrieve(key: String) throws -> Data? {
storage[key]
}
func remove(key: String) throws {
storage[key] = nil
}
} Also, make sure to synchronize access to the Let me know if that clarifies things a bit. Thanks! |
I'm not actually using Supabase for anything authentication-related so that probably wouldn't have caused a problem nor occurred to me but your explanation and approach makes sense. Thanks a lot @grdsdev ! |
What you're using Supabase for? You may want to use only the sub-package separately then, instead of |
At the moment I'm using it to store files and retrieve files from Supabase buckets, but I'm not ruling out adding more functionality in the future. I believe I need |
Got it.
If you're using only storage, you can add |
Feature request
Add support for supabase-swift on Linux.
Is your feature request related to a problem? Please describe.
I'm trying to build a Swift on the server application and was hoping to use the Supabase SDK to do so, but not able to right now.
Describe the solution you'd like
It looks like it mostly should work, but ran into an issue around some URLSession APIs that don't seem to be available on Linux. I believe it should be something you can work around, I found this blog post discussing the subject, and while I don't know the library's history I saw some
#if canImport(FoundationNetworking)
checks in the code base already so I suspect some Linux support was at least attempted.Describe alternatives you've considered
Using the REST API, but making this change would benefit more than just me, it would open up a whole class of possibilities for anyone using Supabase from the server.
Additional context
This is the failed build log for the issue I'm running into.
The text was updated successfully, but these errors were encountered: