fix: naming convention
This commit is contained in:
parent
c080a7e7bc
commit
1a95a8b689
@ -82,7 +82,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
analytics: {
|
analytics: {
|
||||||
enabled: JSON.parse(SECRET_ANALYTICS_ENABLED),
|
enabled: JSON.parse(SECRET_ANALYTICS_ENABLED),
|
||||||
ipSalt: SECRET_ANALYTICS_HMAC_SECRET,
|
hmacSecret: SECRET_ANALYTICS_HMAC_SECRET,
|
||||||
},
|
},
|
||||||
logger: true,
|
logger: true,
|
||||||
cors: '*',
|
cors: '*',
|
||||||
|
@ -5,12 +5,12 @@ import { getCacheKey, getFromCache, setCache } from '../helpers/cache.js';
|
|||||||
import getClientIp from '../helpers/client-ip.js';
|
import getClientIp from '../helpers/client-ip.js';
|
||||||
import prisma from '../services/prisma.js';
|
import prisma from '../services/prisma.js';
|
||||||
|
|
||||||
const { enabled, ipSalt } = config.get('analytics');
|
const { enabled, hmacSecret } = config.get('analytics');
|
||||||
|
|
||||||
function createUniqueId(ip, userAgent) {
|
function createUniqueId(ip, userAgent) {
|
||||||
// Use HMAC for secure hashing
|
// Use HMAC for secure hashing
|
||||||
return crypto
|
return crypto
|
||||||
.createHmac('sha256', ipSalt)
|
.createHmac('sha256', hmacSecret)
|
||||||
.update(ip + userAgent)
|
.update(ip + userAgent)
|
||||||
.digest('hex');
|
.digest('hex');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user