From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server-vie001.gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1741185661; bh=ejdSao+tqdiDVgZhdKsvVlhZp3OQXPKPg3w2GFz4VCw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Message-ID:Date:From: Reply-To:Subject:To:Cc:In-Reply-To:References:Resent-Date: Resent-From:Resent-To:Resent-Cc:User-Agent:Content-Type: Content-Transfer-Encoding; b=MDZelgMrHu+3KRRGXY0pIM5wk8Ytxizz6CNufXiTEFbAnhHhJofQ7vOh8uHKDEOX8 tpb/v9fo9FvJAC8G4WGyHE+UC9cgj4iKSryZrti4DVNnTHHarXoqtYZ0IZ+hAvBEIK L0cDEbH3RL2xjOybGoYT79WHjr8t3dWf7dWAnRC11FRoGESjHyUP+uXnvNnWzEFGsS 61jmwc/wYnQFBSvbFP+C0DRlYipMpl8YEayP13RL9lxFWOC7JdPucr1o1Oyjq/mfaS xsSpG1PMcs+FK7Km3h/SzhJqloCcEVoQssRiEuUFa+xjeNiHUa98XF8ea9vWlh2KIh IMNCyWknCJPUA== Received: from localhost.localdomain (unknown [203.217.140.198]) by server-vie001.gnuweeb.org (Postfix) with ESMTPSA id BBEB520B4833; Wed, 5 Mar 2025 14:41:00 +0000 (UTC) From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v1 10/17] feat(http): Use PUBLIC_BASE_URL for each environment Date: Wed, 5 Mar 2025 21:40:09 +0700 Message-ID: <20250305144018.267-11-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.46.0.windows.1 In-Reply-To: <20250305144018.267-1-kiizuha@gnuweeb.org> References: <20250305144018.267-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Use PUBLIC_BASE_URL to easily control the base URL API for each environment. Signed-off-by: Muhammad Rizki --- .env.development.example | 2 ++ .env.production.example | 2 ++ .gitignore | 2 +- src/lib/hooks/http.svelte.ts | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .env.development.example create mode 100644 .env.production.example diff --git a/.env.development.example b/.env.development.example new file mode 100644 index 0000000..882db7f --- /dev/null +++ b/.env.development.example @@ -0,0 +1,2 @@ +# remove .example filename suffix +PUBLIC_BASE_URL="https://mail-staging.gnuweeb.org/api.php" diff --git a/.env.production.example b/.env.production.example new file mode 100644 index 0000000..882db7f --- /dev/null +++ b/.env.production.example @@ -0,0 +1,2 @@ +# remove .example filename suffix +PUBLIC_BASE_URL="https://mail-staging.gnuweeb.org/api.php" diff --git a/.gitignore b/.gitignore index 1ea8d04..48aea9e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ Thumbs.db # Env .env .env.* -!.env.example +!.env.*.example !.env.test # Vite diff --git a/src/lib/hooks/http.svelte.ts b/src/lib/hooks/http.svelte.ts index 78273a1..d3445d9 100644 --- a/src/lib/hooks/http.svelte.ts +++ b/src/lib/hooks/http.svelte.ts @@ -1,3 +1,4 @@ +import { PUBLIC_BASE_URL } from "$env/static/public"; import * as typing from "$typings"; import axios from "axios"; import type { @@ -8,7 +9,7 @@ import type { } from "axios"; const client = axios.create({ - baseURL: "https://mail.gnuweeb.org/api.php" + baseURL: PUBLIC_BASE_URL }); const http = async (prop: AxiosRequestConfig) => { -- Muhammad Rizki