mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-06 21:50:05 +00:00
Use generalized prod config var (#3574)
This commit is contained in:
3
src/config/comfyApi.ts
Normal file
3
src/config/comfyApi.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const COMFY_API_BASE_URL = __USE_PROD_CONFIG__
|
||||
? 'https://api.comfy.org'
|
||||
: 'https://stagingapi.comfy.org'
|
||||
@@ -1,15 +1,15 @@
|
||||
import { FirebaseOptions } from 'firebase/app'
|
||||
|
||||
// const DEV_CONFIG: FirebaseOptions = {
|
||||
// apiKey: 'AIzaSyDa_YMeyzV0SkVe92vBZ1tVikWBmOU5KVE',
|
||||
// authDomain: 'dreamboothy-dev.firebaseapp.com',
|
||||
// databaseURL: 'https://dreamboothy-dev-default-rtdb.firebaseio.com',
|
||||
// projectId: 'dreamboothy-dev',
|
||||
// storageBucket: 'dreamboothy-dev.appspot.com',
|
||||
// messagingSenderId: '313257147182',
|
||||
// appId: '1:313257147182:web:be38f6ebf74345fc7618bf',
|
||||
// measurementId: 'G-YEVSMYXSPY'
|
||||
// }
|
||||
const DEV_CONFIG: FirebaseOptions = {
|
||||
apiKey: 'AIzaSyDa_YMeyzV0SkVe92vBZ1tVikWBmOU5KVE',
|
||||
authDomain: 'dreamboothy-dev.firebaseapp.com',
|
||||
databaseURL: 'https://dreamboothy-dev-default-rtdb.firebaseio.com',
|
||||
projectId: 'dreamboothy-dev',
|
||||
storageBucket: 'dreamboothy-dev.appspot.com',
|
||||
messagingSenderId: '313257147182',
|
||||
appId: '1:313257147182:web:be38f6ebf74345fc7618bf',
|
||||
measurementId: 'G-YEVSMYXSPY'
|
||||
}
|
||||
|
||||
const PROD_CONFIG: FirebaseOptions = {
|
||||
apiKey: 'AIzaSyC2-fomLqgCjb7ELwta1I9cEarPK8ziTGs',
|
||||
@@ -22,8 +22,7 @@ const PROD_CONFIG: FirebaseOptions = {
|
||||
measurementId: 'G-3ZBD3MBTG4'
|
||||
}
|
||||
|
||||
// To test with prod config while using dev server, set USE_PROD_FIREBASE_CONFIG=true in .env
|
||||
// Otherwise, build with `npm run build` the and set `--front-end-root` to `ComfyUI_frontend/dist`
|
||||
export const FIREBASE_CONFIG: FirebaseOptions = __USE_PROD_FIREBASE_CONFIG__
|
||||
// To test with prod config while using dev server, set USE_PROD_CONFIG=true in .env
|
||||
export const FIREBASE_CONFIG: FirebaseOptions = __USE_PROD_CONFIG__
|
||||
? PROD_CONFIG
|
||||
: PROD_CONFIG // Just force prod to save time for now. change back later
|
||||
: DEV_CONFIG
|
||||
|
||||
@@ -16,6 +16,7 @@ import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useFirebaseAuth } from 'vuefire'
|
||||
|
||||
import { COMFY_API_BASE_URL } from '@/config/comfyApi'
|
||||
import { t } from '@/i18n'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { operations } from '@/types/comfyRegistryTypes'
|
||||
@@ -35,9 +36,6 @@ type AccessBillingPortalResponse =
|
||||
type AccessBillingPortalReqBody =
|
||||
operations['AccessBillingPortal']['requestBody']
|
||||
|
||||
// TODO: Switch to prod api based on environment (requires prod api to be ready)
|
||||
const API_BASE_URL = 'https://stagingapi.comfy.org'
|
||||
|
||||
export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
// State
|
||||
const loading = ref(false)
|
||||
@@ -105,7 +103,7 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
return null
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE_URL}/customers/balance`, {
|
||||
const response = await fetch(`${COMFY_API_BASE_URL}/customers/balance`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
@@ -137,7 +135,7 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
const createCustomer = async (
|
||||
token: string
|
||||
): Promise<CreateCustomerResponse> => {
|
||||
const createCustomerRes = await fetch(`${API_BASE_URL}/customers`, {
|
||||
const createCustomerRes = await fetch(`${COMFY_API_BASE_URL}/customers`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -243,7 +241,7 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
customerCreated.value = true
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE_URL}/customers/credit`, {
|
||||
const response = await fetch(`${COMFY_API_BASE_URL}/customers/credit`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -284,7 +282,7 @@ export const useFirebaseAuthStore = defineStore('firebaseAuth', () => {
|
||||
return null
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE_URL}/customers/billing`, {
|
||||
const response = await fetch(`${COMFY_API_BASE_URL}/customers/billing`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user