Files
speckle-server/packages/server/bootstrap.js
T
Kristaps Fabians Geikins a6287fc06d feat(fe2 & server): saved views foundation (list & view) + bits n bobs (#5163)
* init db migration

* WIP store view

* create service call

* WIP insertion

* insert sort of works

* moving code arounmd

* creation tests

* avoid duplicate entries

* fixes from main

* basic group retrieval works

* group filtering works

* WIP view listing

* filter by acl

* fixes + WIP single group retrieval

* wip pivot

* more pivot query fixes

* tests fixed after pivot

* views list tests

* fixing test command

* business plan only checks

* more tests for coverage

* .dts import fix

* cli fix

* anutha one

* auth policy tests for business plan access

* WIP saved views panel base

* BE listing adjustments

* WIP group rendering

* group render done

* WIP post create cache updates

* listing fine?

* my vs theirs

* auto open

* minor fixes

* click load omg

* nicely loading views

* type fix

* less spammy loading

* another type fix:

* more lint fix

* test fix

* codecov disable

* moar coverage

* fix sidebar flashin

* more test coverage

* more test cvoverage

* minor adfjustments

* adj

* saved view wipe fixes

* CSR viewer

* more improvements

* extra feature flag checks

* lint fix

* feature flags fix

* more test fixes
2025-08-05 11:52:50 +03:00

55 lines
1.6 KiB
JavaScript

import dotenv from 'dotenv'
import {
isTestEnv,
isDevEnv,
isApolloMonitoringEnabled,
getApolloServerVersion,
getServerVersion
} from '@/modules/shared/helpers/envHelper'
import { logger } from '@/observability/logging'
import { initOpenTelemetry } from '@/observability/otel'
import { patchKnex } from '@/modules/core/patches/knex'
import { appRoot, packageRoot, isTsMode } from '#/root.js'
import inspector from 'node:inspector'
/**
* Bootstrap module that should be imported at the very top of each entry point module
*/
// Initializing env vars
if (isApolloMonitoringEnabled() && !getApolloServerVersion()) {
process.env.APOLLO_SERVER_USER_VERSION = getServerVersion()
}
// If running in test env, load .env.test first
// (appRoot necessary, cause env files aren't loaded through require()/import() calls)
if (isTestEnv()) {
const { error } = dotenv.config({ path: `${packageRoot}/.env.test` })
if (error) {
const e = new Error(
'Attempting to run tests without an .env.test file properly set up! Check readme!'
)
logger.error(e)
process.exit(1)
}
}
// Custom inspector init, when debugging doesn't work any other way
// (e.g. due to various child processes capturing the --inspect flag)
const startDebugger = process.env.START_DEBUGGER
if ((isTestEnv() || isDevEnv()) && startDebugger) {
if (!inspector.url()) {
console.log('Debugger starting on process ' + process.pid)
inspector.open(0, undefined, true)
}
}
// Load dotenv
dotenv.config({ path: `${packageRoot}/.env` })
// knex is a singleton controlled by module so can't wait til app init
initOpenTelemetry()
patchKnex()
export { appRoot, packageRoot, isTsMode }