Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/components/dialog/header/SettingDialogHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
<script setup lang="ts">
import Tag from 'primevue/tag'

// Global variable from vite build defined in global.d.ts
// eslint-disable-next-line no-undef
const isStaging = !__USE_PROD_CONFIG__
import { isStaging } from '@/config/staging'
</script>

<style scoped>
Expand Down
20 changes: 20 additions & 0 deletions src/config/staging.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { computed } from 'vue'

import { isCloud } from '@/platform/distribution/types'
import { remoteConfig } from '@/platform/remoteConfig/remoteConfig'

const BUILD_TIME_IS_STAGING = !__USE_PROD_CONFIG__

/**
* Returns whether the current environment is staging.
* - Cloud builds use runtime configuration (firebase_config.projectId containing '-dev')
* - OSS / localhost builds fall back to the build-time config determined by __USE_PROD_CONFIG__
*/
export const isStaging = computed(() => {
if (!isCloud) {
return BUILD_TIME_IS_STAGING
}

const projectId = remoteConfig.value.firebase_config?.projectId
return projectId?.includes('-dev') ?? BUILD_TIME_IS_STAGING
})