feat(tracking): ✨ Add logging and dependency initialization for DeviceEnrichmentService
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
d356a0194d
commit
4c9294706e
1 changed files with 14 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { Injectable, Logger, OnModuleInit } from '@nestjs/common';
|
||||
import * as crypto from 'crypto';
|
||||
import * as geoip from 'geoip-lite';
|
||||
import geoip from 'geoip-lite';
|
||||
import type { OrganizationType, ResponseTier, ProxyType } from '@lilith/gov-detection';
|
||||
import { GovDetectionService } from './gov-detection.service';
|
||||
|
||||
|
|
@ -66,9 +66,20 @@ interface ParsedUserAgent {
|
|||
}
|
||||
|
||||
@Injectable()
|
||||
export class DeviceEnrichmentService {
|
||||
export class DeviceEnrichmentService implements OnModuleInit {
|
||||
private readonly logger = new Logger(DeviceEnrichmentService.name);
|
||||
|
||||
constructor(private readonly govDetection: GovDetectionService) {}
|
||||
|
||||
onModuleInit() {
|
||||
const test = geoip.lookup('8.8.8.8');
|
||||
if (test?.country) {
|
||||
this.logger.log(`GeoIP operational — test lookup returned ${test.country}`);
|
||||
} else {
|
||||
this.logger.error('GeoIP NOT WORKING — test lookup for 8.8.8.8 returned null. Country data will be unavailable.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enrich device data from User-Agent, IP, and client data
|
||||
* NOTE: IP address is NOT stored - only used for geo lookup, then discarded
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue