security: remove any hardcoded credentials from codebase
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { supabase } from "./supabase";
|
import { supabase } from "./supabase";
|
||||||
|
|
||||||
const DEFAULT_API_URL = "https://api.menul.io";
|
const API_URL = process.env.EXPO_PUBLIC_API_URL ?? "http://localhost:3001";
|
||||||
const API_URL = process.env.EXPO_PUBLIC_API_URL || DEFAULT_API_URL;
|
|
||||||
|
|
||||||
async function authHeaders(): Promise<Record<string, string>> {
|
async function authHeaders(): Promise<Record<string, string>> {
|
||||||
const { data } = await supabase.auth.getSession();
|
const { data } = await supabase.auth.getSession();
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ import "react-native-url-polyfill/auto";
|
|||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
import { createClient } from "@supabase/supabase-js";
|
import { createClient } from "@supabase/supabase-js";
|
||||||
|
|
||||||
const DEFAULT_SUPABASE_URL = "https://fwahdopsyvryvjaqande.supabase.co";
|
const url = process.env.EXPO_PUBLIC_SUPABASE_URL ?? "";
|
||||||
const DEFAULT_SUPABASE_ANON_KEY = "sb_publishable_9YsK7YU7xfzxJQsz3x5iMA_LHCqUN3b";
|
const anonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY ?? "";
|
||||||
|
|
||||||
const url = process.env.EXPO_PUBLIC_SUPABASE_URL || DEFAULT_SUPABASE_URL;
|
if (!url || !anonKey) {
|
||||||
const anonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY || DEFAULT_SUPABASE_ANON_KEY;
|
console.warn("⚠️ EXPO_PUBLIC_SUPABASE_URL veya EXPO_PUBLIC_SUPABASE_ANON_KEY tanımlı değil.");
|
||||||
|
}
|
||||||
|
|
||||||
export const supabase = createClient(url, anonKey, {
|
export const supabase = createClient(url || "https://placeholder.supabase.co", anonKey || "placeholder", {
|
||||||
auth: {
|
auth: {
|
||||||
storage: AsyncStorage,
|
storage: AsyncStorage,
|
||||||
autoRefreshToken: true,
|
autoRefreshToken: true,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
const DEFAULT_WEB_URL = "https://menul.io";
|
const WEB_BASE_URL = process.env.EXPO_PUBLIC_WEB_URL || "http://localhost:3000";
|
||||||
const WEB_BASE_URL = process.env.EXPO_PUBLIC_WEB_URL || DEFAULT_WEB_URL;
|
|
||||||
|
|
||||||
export function getPublicMenuUrl(slug: string): string {
|
export function getPublicMenuUrl(slug: string): string {
|
||||||
if (WEB_BASE_URL.includes("menul.io")) {
|
if (WEB_BASE_URL.includes("menul.io")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user