I am using a local Supabase CLI to develop my database structure to then deploy to my Supabase project using migrations.
In one of the SQL functions I need to provide the service key and the project URL:
declare
project_url text := '<YOURPROJECTURL>';
service_role_key text := '<YOURSERVICEROLEKEY>'; -- full access needed
This is an issue for two reasons:
- The project url and service role keys differ between my local and online databases, so I would have to manually update these before deploying my changes.
- These migration files will be uploaded to GitHub, and I don't want to share my service role key.
Is there a way to insert these values as variables in the .sql migration files instead?
From my search I haven't found a good way to inject these variables. Is this possible at all, or what best practice can I follow to resolve this issue?