环境变量调整

This commit is contained in:
joylink_fanyuhong 2024-04-02 20:20:23 +08:00
parent ce211464a9
commit 9f8d45f450
3 changed files with 11 additions and 11 deletions

View File

@ -10,9 +10,9 @@
"format": "prettier --write \"**/*.{js,ts,vue,scss,html,md,json}\" --ignore-path .gitignore",
"test": "echo \"No test specified\" && exit 0",
"dev": "quasar dev",
"build": "set URL_ENV=local_test&&quasar build",
"build:test": "API_URL=local quasar build",
"build:publish": "set URL_ENV=publish&&quasar build",
"build": "URL_ENV=local quasar build",
"build:test": "URL_ENV=test quasar build",
"build:publish": "URL_ENV=publish quasar build",
"protoc": "node scripts/proto.cjs",
"sync": "node scripts/sync.cjs"
},

View File

@ -55,6 +55,7 @@ module.exports = configure(function (/* ctx */) {
env: {
// test:测试服务器publish正式服务器其他本地
ENV_MODE: process.env.NODE_ENV,
URL_ENV: process.env.URL_ENV
},
target: {
browser: ['es2020'],

View File

@ -1,16 +1,15 @@
function getHost(): string {
console.log(process.env.ENV_MODE, process.env.URL_ENV, '000');
if (process.env.ENV_MODE == 'test') {
if (process.env.URL_ENV == 'test') {
return 'test.joylink.club/bjrtsts-server';
} else if (process.env.ENV_MODE == 'publish') {
} else if (process.env.URL_ENV == 'publish') {
return 'joylink.club/bjrtsts-server';
} else if (process.env.ENV_MODE == 'local_test') {
} else if (process.env.URL_ENV == 'local_test') {
return '192.168.33.233:9091';
}
// return '192.168.3.7:9091';
// return '192.168.3.47:9091';
// return '192.168.3.37:9091';
// return '192.168.33.207:9091'; // 张骞
return '192.168.33.207:9091'; // 张骞
// return '192.168.33.93:9091';
// return '192.168.3.37:9091'; //卫志宏
// return 'test.joylink.club/bjrtsts-service'; // 测试
@ -19,7 +18,7 @@ function getHost(): string {
export function getHttpBase() {
let protocol = 'http';
if (['publish'].includes(process.env.ENV_MODE as string)) {
if (['publish'].includes(process.env.URL_ENV as string)) {
protocol = 'https';
}
return `${protocol}://${getHost()}`;
@ -31,12 +30,12 @@ export function getWebsocketUrl() {
// let host = 'test.joylink.club';
let port = '8083';
let url = `${protocol}://${host}:${port}`;
if (process.env.ENV_MODE == 'test') {
if (process.env.URL_ENV == 'test') {
// protocol = 'wss';
host = 'test.joylink.club/bjrtsts-server';
port = '';
url = `${protocol}://${host}`;
} else if (process.env.ENV_MODE == 'publish') {
} else if (process.env.URL_ENV == 'publish') {
protocol = 'wss';
host = 'joylink.club/bjrtsts-server';
port = '';