This commit is contained in:
Douglas Barone 2023-10-24 08:08:12 -04:00
parent 9165dcf62e
commit 2dbba866a0

View File

@ -3,11 +3,8 @@ import { Context } from '../trpc'
export function getIpFromContext({ req }: Context) { export function getIpFromContext({ req }: Context) {
if (process.env.NODE_ENV === 'development') return '10.7.16.254' if (process.env.NODE_ENV === 'development') return '10.7.16.254'
let ip: string = ''
if (req.headers['x-forwarded-for']) if (req.headers['x-forwarded-for'])
ip = req.headers['x-forwarded-for'] as string return req.headers['x-forwarded-for'] as string
else ip = req.ip.split('::ffff:')[1]
return ip return req.ip.split('::ffff:')[1]
} }