Skip to content
Snippets Groups Projects
Select Git revision
  • 4bc7414df2fa67ad51e1512d3ef1ea5ddbb99c1b
  • main default protected
  • next
  • chore/update-static-data
  • renovate/main-redis-5.x
  • feat/gnupg
  • fix/36615b-branch-reuse-no-cache
  • chore/punycode
  • refactor/pin-new-value
  • feat/36219--git-x509-signing
  • feat/structured-logger
  • hotfix/39.264.1
  • feat/skip-dangling
  • gh-readonly-queue/next/pr-36034-7a061c4ca1024a19e2c295d773d9642625d1c2be
  • hotfix/39.238.3
  • refactor/gitlab-auto-approve
  • feat/template-strings
  • gh-readonly-queue/next/pr-35654-137d934242c784e0c45d4b957362214f0eade1d7
  • fix/32307-global-extends-merging
  • fix/32307-global-extends-repositories
  • gh-readonly-queue/next/pr-35009-046ebf7cb84ab859f7fefceb5fa53a54ce9736f8
  • 41.55.3
  • 41.55.2
  • 41.55.1
  • 41.55.0
  • 41.54.0
  • 41.53.1
  • 41.53.0
  • 41.52.3
  • 41.52.2
  • 41.52.1
  • 41.52.0
  • 41.51.2
  • 41.51.1
  • 41.51.0
  • 41.50.0
  • 41.49.1
  • 41.49.0
  • 41.48.1
  • 41.48.0
  • 41.47.1
41 results

pristine.spec.ts

Blame
  • server.js 1.81 KiB
    import fs from 'fs'
    import path from 'path'
    import { fileURLToPath } from 'url'
    import configModule from 'config'
    import Sentry from '@sentry/node'
    import Server from './core/server/server.js'
    
    // Set up Sentry reporting as early in the process as possible.
    const config = configModule.util.toObject()
    const disabledIntegrations = ['Console', 'Http']
    Sentry.init({
      dsn: process.env.SENTRY_DSN || config.private.sentry_dsn,
      integrations: integrations => {
        const filtered = integrations.filter(
          integration => !disabledIntegrations.includes(integration.name),
        )
        if (filtered.length !== integrations.length - disabledIntegrations.length) {
          throw Error(
            `An error occurred while filtering integrations. The following inetgrations were found: ${integrations.map(
              ({ name }) => name,
            )}`,
          )
        }
        return filtered
      },
    })
    
    if (+process.argv[2]) {
      config.public.bind.port = +process.argv[2]
    }
    if (process.argv[3]) {
      config.public.bind.address = process.argv[3]
    }
    
    console.log('Configuration:')
    console.dir(config.public, { depth: null })
    
    if (fs.existsSync('.env')) {
      console.error(
        'Legacy .env file found. It should be deleted and replaced with environment variables or config/local.yml',
      )
      process.exit(1)
    }
    
    if (config.private.redis_url != null) {
      console.error(
        'RedisTokenPersistence has been removed. Migrate to SqlTokenPersistence',
      )
      process.exit(1)
    }
    
    const legacySecretsPath = path.join(
      path.dirname(fileURLToPath(import.meta.url)),
      'private',
      'secret.json',
    )
    if (fs.existsSync(legacySecretsPath)) {
      console.error(
        `Legacy secrets file found at ${legacySecretsPath}. It should be deleted and secrets replaced with environment variables or config/local.yml`,
      )
      process.exit(1)
    }
    export const server = new Server(config)
    
    await server.start()