Refactor supabase.ts into modules

Refactor the supabase.ts file into smaller modules, separating test functionalities and default client configurations while preserving all code functionalities.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 12:12:07 +00:00
parent 3a14914482
commit 2493f958de
5 changed files with 291 additions and 267 deletions

View File

@@ -0,0 +1,29 @@
// 온프레미스 Supabase URL과 anon key 설정
export const getSupabaseUrl = () => {
// 로컬 스토리지에서 설정된 URL을 우선 사용
const storedUrl = localStorage.getItem('supabase_url');
if (storedUrl) return storedUrl;
// 환경 변수 또는 기본값 사용
return process.env.SUPABASE_URL || 'http://a11.ism.kr:8000';
};
export const getSupabaseKey = () => {
// 로컬 스토리지에서 설정된 키를 우선 사용
const storedKey = localStorage.getItem('supabase_key');
if (storedKey) return storedKey;
// 환경 변수 또는 기본값 사용
return process.env.SUPABASE_ANON_KEY || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlzcyI6InN1cGFiYXNlIiwiaWF0IjoxNzQyMDM5MzU4LCJleHAiOjQ4OTU2MzkzNTh9.XK0vetdwv_H2MHj4ewTfZGtSbrbSNDaV5xJhNo_Hdp8';
};
// 온프레미스 연결을 위한 설정 도우미 함수
export const configureSupabase = (url: string, key: string) => {
// 로컬 스토리지에 설정 저장
localStorage.setItem('supabase_url', url);
localStorage.setItem('supabase_key', key);
// 페이지 새로고침 - 새로운 설정으로 Supabase 클라이언트 초기화
window.location.reload();
};