-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Feature request
Is your feature request related to a problem? Please describe.
When you have a local development server through the CLI, you can't connect to it using supabase-php as it's constructor(s) are all split up and has (as of right now) no way to just specify a full URL. This is worsened when you also have whatever you're working on also in docker, which then uses http://supabase_kong_core as it's hostname instead.
Describe the solution you'd like
A method to just specify the full URL rather than specifying each variable that ends up building a URL anyway. (Maybe possible to just check if $reference_id is a valid URL and use that instead? - bonus: it'll also follow what supabase-js and others do as well)
Describe alternatives you've considered
Adding an entry to /etc/hosts could work if what you're working on always runs on the host machine (probably - I haven't tested fully).
The only solution right now is to just use actual supabase (which eats into limits) or an externally self-hosted instance on a domain. If using docker, you need to link both containers in the same network, find whatever local IP kong is using (which occasionally changes), and then edit the hosts file in the container you want to connect from.
Additional context
The current solution also adds a bunch of unnecessary complexity (imo). My current mess (its bad i know, but its 3AM):
$api_key = 'some-api-key-probs-from-env';
$raw_domain = 'http://supabase.or.whatever';
$domain_but_exploded = explode('.', $raw_domain);
$scheme = explode('://', $raw_domain)[0]; // http
$reference_id = preg_replace('/https?:\/\//', '', $domain_but_exploded[0]); // supabase
$domain = $domain_but_exploded[1] . '.' . $domain_but_exploded[2]; // or.whatever
$StorageFile = new StorageFile($api_key, $reference_id, 'users', $domain, $scheme);Could simply just be:
$api_key = 'some-api-key-probs-from-env';
$reference_id = 'http://supabase.or.whatever';
$StorageFile = new StorageFile($api_key, $reference_id, 'users');
// (A lazy but efficient:tm: solution could just be to check for `http(s)://` at the start of the reference_id)