fix env loading in worker
This commit is contained in:
		
							parent
							
								
									17da24ce24
								
							
						
					
					
						commit
						b6e4f97668
					
				@ -1,5 +1,6 @@
 | 
			
		||||
// environment variables are loaded from files and imports run before the rest of the code
 | 
			
		||||
import './loadenv.js'
 | 
			
		||||
import PgBoss from 'pg-boss'
 | 
			
		||||
import nextEnv from '@next/env'
 | 
			
		||||
import createPrisma from '@/lib/create-prisma.js'
 | 
			
		||||
import {
 | 
			
		||||
  autoDropBolt11s, checkInvoice, checkPendingDeposits, checkPendingWithdrawals,
 | 
			
		||||
@ -34,11 +35,8 @@ import {
 | 
			
		||||
import { thisDay } from './thisDay.js'
 | 
			
		||||
import { isServiceEnabled } from '@/lib/sndev.js'
 | 
			
		||||
 | 
			
		||||
const { loadEnvConfig } = nextEnv
 | 
			
		||||
const { ApolloClient, HttpLink, InMemoryCache } = apolloClient
 | 
			
		||||
 | 
			
		||||
loadEnvConfig('.', process.env.NODE_ENV === 'development')
 | 
			
		||||
 | 
			
		||||
async function work () {
 | 
			
		||||
  const boss = new PgBoss(process.env.DATABASE_URL)
 | 
			
		||||
  const models = createPrisma({
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										3
									
								
								worker/loadenv.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								worker/loadenv.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
			
		||||
import nextEnv from '@next/env'
 | 
			
		||||
const { loadEnvConfig } = nextEnv
 | 
			
		||||
loadEnvConfig('.', process.env.NODE_ENV === 'development')
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user