chore: revert back environment variable prefixes to VITE_
This commit is contained in:
@@ -3,7 +3,7 @@ import { execSync } from "child_process"
|
||||
import fs from "fs"
|
||||
|
||||
const envFileContent = Object.entries(process.env)
|
||||
.filter(([env]) => env.startsWith("APP_"))
|
||||
.filter(([env]) => env.startsWith("VITE_"))
|
||||
.map(
|
||||
([env, val]) =>
|
||||
`${env}=${val.startsWith('"') && val.endsWith('"') ? val : `"${val}"`}`
|
||||
|
||||
@@ -17,21 +17,23 @@ const currentUser$ = new BehaviorSubject<HoppUser | null>(null)
|
||||
export const probableUser$ = new BehaviorSubject<HoppUser | null>(null)
|
||||
|
||||
async function logout() {
|
||||
await axios.get(`${import.meta.env.APP_BACKEND_API_URL}/auth/logout`, {
|
||||
await axios.get(`${import.meta.env.VITE_BACKEND_API_URL}/auth/logout`, {
|
||||
withCredentials: true,
|
||||
})
|
||||
}
|
||||
|
||||
async function signInUserWithGithubFB() {
|
||||
window.location.href = `${import.meta.env.APP_BACKEND_API_URL}/auth/github`
|
||||
window.location.href = `${import.meta.env.VITE_BACKEND_API_URL}/auth/github`
|
||||
}
|
||||
|
||||
async function signInUserWithGoogleFB() {
|
||||
window.location.href = `${import.meta.env.APP_BACKEND_API_URL}/auth/google`
|
||||
window.location.href = `${import.meta.env.VITE_BACKEND_API_URL}/auth/google`
|
||||
}
|
||||
|
||||
async function signInUserWithMicrosoftFB() {
|
||||
window.location.href = `${import.meta.env.APP_BACKEND_API_URL}/auth/microsoft`
|
||||
window.location.href = `${
|
||||
import.meta.env.VITE_BACKEND_API_URL
|
||||
}/auth/microsoft`
|
||||
}
|
||||
|
||||
async function getInitialUserDetails() {
|
||||
@@ -51,7 +53,7 @@ async function getInitialUserDetails() {
|
||||
message: string
|
||||
}>
|
||||
}>(
|
||||
`${import.meta.env.APP_BACKEND_GQL_URL}`,
|
||||
`${import.meta.env.VITE_BACKEND_GQL_URL}`,
|
||||
{
|
||||
query: `query Me {
|
||||
me {
|
||||
@@ -145,7 +147,7 @@ async function setInitialUser() {
|
||||
|
||||
async function refreshToken() {
|
||||
const res = await axios.get(
|
||||
`${import.meta.env.APP_BACKEND_API_URL}/auth/refresh`,
|
||||
`${import.meta.env.VITE_BACKEND_API_URL}/auth/refresh`,
|
||||
{
|
||||
withCredentials: true,
|
||||
}
|
||||
@@ -164,7 +166,7 @@ async function refreshToken() {
|
||||
|
||||
async function sendMagicLink(email: string) {
|
||||
const res = await axios.post(
|
||||
`${import.meta.env.APP_BACKEND_API_URL}/auth/signin`,
|
||||
`${import.meta.env.VITE_BACKEND_API_URL}/auth/signin`,
|
||||
{
|
||||
email,
|
||||
},
|
||||
@@ -282,7 +284,7 @@ export const def: AuthPlatformDef = {
|
||||
const deviceIdentifier = getLocalConfig("deviceIdentifier")
|
||||
|
||||
await axios.post(
|
||||
`${import.meta.env.APP_BACKEND_API_URL}/auth/verify`,
|
||||
`${import.meta.env.VITE_BACKEND_API_URL}/auth/verify`,
|
||||
{
|
||||
token: token,
|
||||
deviceIdentifier,
|
||||
|
||||
@@ -19,9 +19,10 @@ import Unfonts from "unplugin-fonts/vite"
|
||||
import legacy from "@vitejs/plugin-legacy"
|
||||
import ImportMetaEnv from "@import-meta-env/unplugin"
|
||||
|
||||
const ENV = loadEnv("development", path.resolve(__dirname, "../../"), ["APP_"])
|
||||
const ENV = loadEnv("development", path.resolve(__dirname, "../../"), ["VITE_"])
|
||||
|
||||
export default defineConfig({
|
||||
envPrefix: process.env.HOPP_ALLOW_RUNTIME_ENV ? "VITE_BUILDTIME_" : "VITE_",
|
||||
envDir: path.resolve(__dirname, "../../"),
|
||||
// TODO: Migrate @hoppscotch/data to full ESM
|
||||
define: {
|
||||
@@ -85,7 +86,7 @@ export default defineConfig({
|
||||
nuxtStyle: true,
|
||||
allowRobots: true,
|
||||
dest: ".sitemap-gen",
|
||||
hostname: ENV.APP_BASE_URL,
|
||||
hostname: ENV.VITE_BASE_URL,
|
||||
})
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user