forgeplus-react/src/utils/env.ts

140 lines
4.8 KiB
TypeScript
Executable File

/*
* @Author: your name
* @Date: 2020-11-09 17:48:52
* @LastEditTime: 2020-11-13 16:31:48
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: /ppte5yg23/src/utils/env.ts
*/
import { DEV } from './env/dev'
export interface ConfigProps {
[key: string]: {
API_SERVER: any
IMG_SERVER: any
REPORT_SERVER: string;
SSH_SERVER: string,
FORGE: String
QQLoginCB: string,
FORGE_SERVER:string,
}
}
export const GlobalConfig: ConfigProps = {
local: {
API_SERVER: 'http://localhost:3000',
IMG_SERVER: 'https://testforgeplus.trustie.net/',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://test-oldweb.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
dev: DEV,
newReactTest: {
// API_SERVER: 'https://test-data.educoder.net',
API_SERVER: ((() => {
let api = 'https://test-data.educoder.net'
const domain = document.domain
let str = document.domain.split(".")
str[0] = str[0] + "-data";
if (domain !== 'test.educoder.net' && domain !== 'localhost') {
api = api.replace("test-data.educoder.net", str.join("."))
}
return api
})()),
SSH_SERVER: "wss://webssh.educoder.net",
IMG_SERVER: 'https://new-testali-cdn.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://test-oldweb.educoder.net/",
QQLoginCB: encodeURIComponent("https://test-data.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
preNewBuild: {
API_SERVER: 'https://pre-data.educoder.net',
// API_SERVER: ((() => {
// let api = 'https://pre-data.educoder.net'
// const domain = document.domain
// let str = document.domain.split(".")
// str[0] = str[0] + "-data";
// if (domain !== 'pre.educoder.net') {
// api = api.replace("pre-data.educoder.net", str.join("."))
// }
// return api
// })()),
IMG_SERVER: 'https://preali-cdn.educoder.net',
SSH_SERVER: "wss://pre-webssh.educoder.net",
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://forge.educoder.net/",
QQLoginCB: encodeURIComponent("https://pre.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
newBuild: {
// API_SERVER: 'https://data.educoder.net',
API_SERVER: ((() => {
let api = 'https://data.educoder.net'
const domain = document.domain
// let str = document.domain.split(".")
// str[0] = str[0] + "-data";
if (domain === 'kepukehuan.educoder.net') {
api = 'https://kepukehuan-data.educoder.net'
}
return api
})()),
SSH_SERVER: "wss://webssh.educoder.net",
REPORT_SERVER: "http://192.168.1.57:3001",
IMG_SERVER: 'https://ali-cdn.educoder.net',
FORGE: "https://code.educoder.net/",
QQLoginCB: encodeURIComponent("https://www.educoder.net"),
FORGE_SERVER:"https://gitlink.org.cn"
},
// test
newTest: {
API_SERVER: 'https://test-data.educoder.net',
IMG_SERVER: 'https://test-data.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
SSH_SERVER: "wss://pre-webssh.educoder.net",
FORGE: "http://test-oldweb.educoder.net/",
QQLoginCB: encodeURIComponent("https://test-data.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
test: {
API_SERVER: '',
IMG_SERVER: '',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "http://test-oldweb.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
preBuild: {
API_SERVER: '',
IMG_SERVER: 'https://preali-cdn.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://forge.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
newWeb: {
API_SERVER: 'https://test-newweb.educoder.net',
IMG_SERVER: 'https://test-newweb.educoder.net/',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "http://test-oldweb.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
build: {
API_SERVER: 'https://data.educoder.net/',
IMG_SERVER: 'https://ali-cdn.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://forge.educoder.net/",
SSH_SERVER: "wss://webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://www.educoder.net"),
FORGE_SERVER:""
},
};
export default GlobalConfig[window.ENV || "dev"]