Cleanup
This commit is contained in:
parent
9165dcf62e
commit
2dbba866a0
|
@ -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]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user