-
Notifications
You must be signed in to change notification settings - Fork 15
feat: add is_local() function to detect Supabase CLI environment #502
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
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 9efed91
☁️ Nx Cloud last updated this comment at |
e2e0542 to
62bac21
Compare
c5e9928 to
9561a5c
Compare
62bac21 to
66f7089
Compare
66f7089 to
948f79e
Compare
9561a5c to
08e5f14
Compare
948f79e to
dcf6478
Compare
08e5f14 to
6797882
Compare
6797882 to
9ee0fa1
Compare
dcf6478 to
5166c57
Compare
5166c57 to
9ea26f2
Compare
9ee0fa1 to
252a4da
Compare
252a4da to
d886b2b
Compare
9ea26f2 to
f466d3e
Compare
🔍 Preview Deployment: Website✅ Deployment successful! 🔗 Preview URL: https://pr-502.pgflow.pages.dev 📝 Details:
_Last updated: _ |
- Introduced SQL function pgflow.is_local to check if running in local Supabase CLI by matching JWT secret - Updated database type definitions to include is_local method - Added migration script to create the is_local function in the database - Included tests to verify is_local behavior with matching, missing, and different JWT secrets - Updated migration tracking files to include the new is_local function
f466d3e to
9efed91
Compare
| -- Create "is_local" function | ||
| CREATE FUNCTION "pgflow"."is_local" () RETURNS boolean LANGUAGE sql STABLE PARALLEL SAFE SET "search_path" = '' AS $$ | ||
| select coalesce( | ||
| current_setting('app.settings.jwt_secret', true) | ||
| = 'super-secret-jwt-token-with-at-least-32-characters-long', | ||
| false | ||
| ) | ||
| $$; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This temporary migration file is causing CI to fail. It should be renamed to remove 'temp' from the filename (e.g., '20251204115929_pgflow_add_is_local.sql') to follow the project's migration naming conventions. The content can remain the same, but the filename must not indicate it's temporary.
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.
🚀 Production Deployment: Website✅ Successfully deployed to production! 🔗 Production URL: https://pgflow.dev 📝 Details:
Deployed at: 2025-12-08T09:16:25+01:00 |

Add
pgflow.is_local()function to detect local development environmentThis PR adds a new SQL function
pgflow.is_local()that detects whether the application is running in a local Supabase CLI environment by checking if the JWT secret matches the known hardcoded local value.The function:
trueonly when the JWT secret exactly matches the Supabase CLI's default valuefalsein all other cases (production environments, custom JWT secrets)falsecoalesceto handle missing configuration valuesAdded comprehensive tests to verify the function works correctly in different scenarios:
This utility will help implement environment-specific behaviors without requiring explicit configuration.