chore: move backend urls to env variables
This commit is contained in:
@@ -16,3 +16,7 @@ MEASUREMENT_ID=G-BBJ3R80PJT
|
|||||||
|
|
||||||
# Base URL
|
# Base URL
|
||||||
BASE_URL=https://hoppscotch.io
|
BASE_URL=https://hoppscotch.io
|
||||||
|
|
||||||
|
# Backend URLs
|
||||||
|
BACKEND_GQL_URL=https://api.hoppscotch.io/graphql
|
||||||
|
BACKEND_WS_URL=wss://api.hoppscotch.io/graphql
|
||||||
|
|||||||
@@ -45,28 +45,23 @@ import {
|
|||||||
} from "~/helpers/fb/auth"
|
} from "~/helpers/fb/auth"
|
||||||
|
|
||||||
const BACKEND_GQL_URL =
|
const BACKEND_GQL_URL =
|
||||||
process.env.context === "production"
|
process.env.BACKEND_GQL_URL ?? "https://api.hoppscotch.io/graphql"
|
||||||
? "https://api.hoppscotch.io/graphql"
|
const BACKEND_WS_URL =
|
||||||
: "https://api.hoppscotch.io/graphql"
|
process.env.BACKEND_WS_URL ?? "wss://api.hoppscotch.io/graphql"
|
||||||
|
|
||||||
// const storage = makeDefaultStorage({
|
// const storage = makeDefaultStorage({
|
||||||
// idbName: "hoppcache-v1",
|
// idbName: "hoppcache-v1",
|
||||||
// maxAge: 7,
|
// maxAge: 7,
|
||||||
// })
|
// })
|
||||||
|
|
||||||
const subscriptionClient = new SubscriptionClient(
|
const subscriptionClient = new SubscriptionClient(BACKEND_WS_URL, {
|
||||||
process.env.context === "production"
|
reconnect: true,
|
||||||
? "wss://api.hoppscotch.io/graphql"
|
connectionParams: () => {
|
||||||
: "wss://api.hoppscotch.io/graphql",
|
return {
|
||||||
{
|
authorization: `Bearer ${authIdToken$.value}`,
|
||||||
reconnect: true,
|
}
|
||||||
connectionParams: () => {
|
},
|
||||||
return {
|
})
|
||||||
authorization: `Bearer ${authIdToken$.value}`,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
authIdToken$.subscribe(() => {
|
authIdToken$.subscribe(() => {
|
||||||
subscriptionClient.client?.close()
|
subscriptionClient.client?.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user