feat: add default sentry
This commit is contained in:
		
							parent
							
								
									72844e4edc
								
							
						
					
					
						commit
						40d294a247
					
				| @ -0,0 +1,2 @@ | ||||
| -- AlterTable | ||||
| ALTER TABLE "Setting" ADD COLUMN "sentryDSN" TEXT; | ||||
| @ -32,6 +32,7 @@ model Setting { | ||||
|   applicationStoragePathMigrationFinished Boolean  @default(false) | ||||
|   proxyDefaultRedirect                    String? | ||||
|   doNotTrack                              Boolean  @default(false) | ||||
|   sentryDSN                               String? | ||||
|   isAPIDebuggingEnabled                   Boolean  @default(false) | ||||
|   isRegistrationEnabled                   Boolean  @default(false) | ||||
|   isAutoUpdateEnabled                     Boolean  @default(false) | ||||
|  | ||||
| @ -36,6 +36,8 @@ declare module 'fastify' { | ||||
| 
 | ||||
| const port = isDev ? 3001 : 3000; | ||||
| const host = '0.0.0.0'; | ||||
| const sentryDSN = 'https://40285978081c4739b3aed4093f0abe7d@o1082494.ingest.sentry.io/6091062'; | ||||
| 
 | ||||
| (async () => { | ||||
| 	const settings = await prisma.setting.findFirst() | ||||
| 	const fastify = Fastify({ | ||||
| @ -177,7 +179,7 @@ const host = '0.0.0.0'; | ||||
| 
 | ||||
| 		setInterval(async () => { | ||||
| 			await migrateServicesToNewTemplate() | ||||
| 		}, isDev ? 1000 : 60000) | ||||
| 		}, isDev ? 10000 : 60000) | ||||
| 
 | ||||
| 		setInterval(async () => { | ||||
| 			await copySSLCertificates(); | ||||
| @ -238,8 +240,8 @@ async function getTagsTemplates() { | ||||
| 	} | ||||
| } | ||||
| async function initServer() { | ||||
| 	const appId = process.env['COOLIFY_APP_ID']; | ||||
| 	try { | ||||
| 		const appId = process.env['COOLIFY_APP_ID']; | ||||
| 		let doNotTrack = false | ||||
| 		if (appId === '') { | ||||
| 			doNotTrack = true | ||||
| @ -248,6 +250,21 @@ async function initServer() { | ||||
| 	} catch (error) { | ||||
| 		console.log(error) | ||||
| 	} | ||||
| 	try { | ||||
| 		const settings = await prisma.setting.findUnique({ where: { id: '0' } }) | ||||
| 		if (!settings.sentryDSN) { | ||||
| 			if (appId == '') { | ||||
| 				console.log('Telemetry disabled') | ||||
| 				return | ||||
| 			} else { | ||||
| 				await prisma.setting.update({ where: { id: '0' }, data: { sentryDSN } }) | ||||
| 			} | ||||
| 		} | ||||
| 		// Initialize Sentry
 | ||||
| 
 | ||||
| 	} catch (error) { | ||||
| 		console.log(error) | ||||
| 	} | ||||
| 	try { | ||||
| 		console.log(`[001] Initializing server...`); | ||||
| 		await asyncExecShell(`docker network create --attachable coolify`); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user