Skip to content

Commit

Permalink
feat(utils/request): override realIP param with env var (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
amphineko authored Apr 11, 2022
1 parent af0a997 commit 16b5259
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import { getCookie, doLogout } from '@/utils/auth';
import router from '@/router';
import { doLogout, getCookie } from '@/utils/auth';
import axios from 'axios';

let baseURL = '';
// Web 和 Electron 跑在不同端口避免同时启动时冲突
Expand Down Expand Up @@ -34,6 +34,10 @@ service.interceptors.request.use(function (config) {
config.params.realIP = '211.161.244.70';
}

if (process.env.VUE_APP_REAL_IP) {
config.params.realIP = process.env.VUE_APP_REAL_IP;
}

const proxy = JSON.parse(localStorage.getItem('settings')).proxyConfig;
if (['HTTP', 'HTTPS'].includes(proxy.protocol)) {
config.params.proxy = `${proxy.protocol}://${proxy.server}:${proxy.port}`;
Expand Down

0 comments on commit 16b5259

Please sign in to comment.