mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-26 17:49:15 +01:00
利用Nginx转发将CRAWLAB_API_ADDRESS设置为默认IP
This commit is contained in:
@@ -2,7 +2,17 @@ import axios from 'axios'
|
||||
import router from '../router'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
// 根据 VUE_APP_BASE_URL 生成 baseUrl
|
||||
let baseUrl = process.env.VUE_APP_BASE_URL ? process.env.VUE_APP_BASE_URL : 'http://localhost:8000'
|
||||
if (!baseUrl.match(/^https?/i)) {
|
||||
baseUrl = `http://${window.location.host}${process.env.VUE_APP_BASE_URL}`
|
||||
}
|
||||
|
||||
// 如果 Docker 中设置了 CRAWLAB_API_ADDRESS 这个环境变量,则会将 baseUrl 覆盖
|
||||
const CRAWLAB_API_ADDRESS = '###CRAWLAB_API_ADDRESS###'
|
||||
if (!CRAWLAB_API_ADDRESS.match('CRAWLAB_API_ADDRESS')) {
|
||||
baseUrl = CRAWLAB_API_ADDRESS
|
||||
}
|
||||
|
||||
const request = (method, path, params, data, others = {}) => {
|
||||
const url = baseUrl + path
|
||||
|
||||
Reference in New Issue
Block a user