Document on-premise Supabase setup
Adds documentation on how to connect to an on-premise Supabase instance.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
// Supabase URL과 anon key 설정
|
||||
const supabaseUrl = 'https://tzmywjqtluhwemhuflhi.supabase.co';
|
||||
// 올바른 anon key 설정 - 유효한 JWT 형식이어야 함
|
||||
const supabaseAnonKey = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InR6bXl3anF0bHVod2VtaHVmbGhpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MDk1NDUzMTUsImV4cCI6MjAyNTEyMTMxNX0.iCPZvMm9KeRjxh2cE-rkpAIxf9XpZzGIpSZBXBSRfoU';
|
||||
// 온프레미스 Supabase URL과 anon key 설정
|
||||
const supabaseUrl = process.env.SUPABASE_URL || 'http://your-onpremise-supabase-url.com';
|
||||
// 온프레미스 anon key 설정
|
||||
const supabaseAnonKey = process.env.SUPABASE_ANON_KEY || 'your-onpremise-anon-key';
|
||||
|
||||
// 유효한 URL이 설정되었는지 확인
|
||||
const isValidUrl = supabaseUrl && supabaseAnonKey &&
|
||||
@@ -21,9 +21,25 @@ try {
|
||||
auth: {
|
||||
autoRefreshToken: true,
|
||||
persistSession: true,
|
||||
// 온프레미스 설치를 위한 추가 설정
|
||||
flowType: 'implicit',
|
||||
},
|
||||
});
|
||||
|
||||
// Supabase 연결 테스트
|
||||
(async () => {
|
||||
try {
|
||||
const { data, error } = await supabaseClient.auth.getSession();
|
||||
if (error) {
|
||||
console.warn('Supabase 연결 테스트 실패:', error.message);
|
||||
} else {
|
||||
console.log('Supabase 연결 성공!');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Supabase 연결 확인 중 오류:', err);
|
||||
}
|
||||
})();
|
||||
|
||||
// Supabase 연결 로그
|
||||
console.log('Supabase 클라이언트가 생성되었습니다.');
|
||||
|
||||
@@ -53,3 +69,14 @@ try {
|
||||
}
|
||||
|
||||
export const supabase = supabaseClient;
|
||||
|
||||
// 온프레미스 연결을 위한 설정 도우미 함수
|
||||
export const configureSupabase = (url: string, key: string) => {
|
||||
// 로컬 스토리지에 설정 저장
|
||||
localStorage.setItem('supabase_url', url);
|
||||
localStorage.setItem('supabase_key', key);
|
||||
|
||||
// 페이지 새로고침 - 새로운 설정으로 Supabase 클라이언트 초기화
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user