Reputation: 566
I just followed the supabase documentation to create a local environment in supabase. The problem I have is that already having a project in react, is there a way for me to start using that environment? I have configured my client.js with the environments given by supabase in local environment. ie:
REACT_APP_SUPABASE_LOCAL_URL > API URL: http://localhost:54321
import { createClient } from '@supabase/supabase-js';
const supabaseUrl = process.env.NODE_ENV === 'development' ? process.env.REACT_APP_SUPABASE_LOCAL_URL : process.env.REACT_APP_SUPABASE_URL;
const supabaseAnonKey = process.env.NODE_ENV === 'development' ? process.env.REACT_APP_SUPABASE_ANON_KEY_LOCAL : process.env.REACT_APP_SUPABASE_ANON_KEY;
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
And my other question is when I point to the db that I already have in production in the local environment, it only brought me the tables but not the data from them. Is there any possibility?
Upvotes: 0
Views: 740
Reputation: 1152
You can either use something like pgdump e.g. see the Supabase docs or you can seed some fake data in your local Supabase project with something like SeedAI.
To dump your data, you can use supabase db dump --data-only [email protected]
, see https://supabase.com/docs/reference/cli/supabase-db-dump . The output from this you can put in your local supabase/seed.sql
file.
Upvotes: 0