diff --git a/src/instrumentation.ts b/src/instrumentation.ts new file mode 100644 index 0000000..2beabfa --- /dev/null +++ b/src/instrumentation.ts @@ -0,0 +1,7 @@ +export async function register() { + if (process.env.NEXT_RUNTIME === 'nodejs') { + const axios = (await import('axios')).default; + const { RMAB_USER_AGENT } = await import('@/lib/utils/user-agent'); + axios.defaults.headers.common['User-Agent'] = RMAB_USER_AGENT; + } +} diff --git a/src/lib/utils/user-agent.ts b/src/lib/utils/user-agent.ts new file mode 100644 index 0000000..b2876d2 --- /dev/null +++ b/src/lib/utils/user-agent.ts @@ -0,0 +1,3 @@ +import { version } from '../../../package.json'; + +export const RMAB_USER_AGENT = `rmab/${version}`;