Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Optimize front-end deployment information

zdm2751e111620c
diff --git a/core/frontend/build/config.ts b/core/frontend/build/config.ts
index e8242626..87c76a2b 100644
--- a/core/frontend/build/config.ts
+++ b/core/frontend/build/config.ts
@@ -1,11 +1,18 @@
-import { ServerConfig } from './interface'
+interface ServerConfig {
+ https: boolean
+ address: string
+ host: string
+ port: number
+ username: string
+ password: string
+}
const serverConfig: Record<string, ServerConfig> = {
'192.168.66.66': {
https: false,
- ip: '192.168.66.66',
- port: 64325,
- sshPort: 22,
+ address: 'http://192.168.66.66:64325',
+ host: '192.168.66.66',
+ port: 0,
username: '---',
password: '---',
},
diff --git a/core/frontend/build/interface.ts b/core/frontend/build/interface.ts
deleted file mode 100644
index 2f4fcdb3..00000000
--- a/core/frontend/build/interface.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-export interface ServerConfig {
- https: boolean
- ip: string
- port: number
- sshPort: number
- username: string
- password: string
-}
diff --git a/core/frontend/build/utils.ts b/core/frontend/build/utils.ts
index 28503855..bad45370 100644
--- a/core/frontend/build/utils.ts
+++ b/core/frontend/build/utils.ts
@@ -19,21 +19,3 @@ export function getServer() {
const name = getEnv('SERVER_NAME')
return serverConfig[name]
}
-
-/**
- * @description 获取代理地址
- * @returns
- */
-export const getProxyAddress = () => {
- const server = getServer()
- return `http${server.https ? 's' : ''}://${server.ip}:${server.port}`
-}
-
-/**
- * @description 获取是否使用 HTTPS
- * @returns
- */
-export function getHttps() {
- const server = getServer()
- return server.https === true
-}
diff --git a/core/frontend/rsbuild.config.ts b/core/frontend/rsbuild.config.ts
index 7cc0e9bf..bded9767 100644
--- a/core/frontend/rsbuild.config.ts
+++ b/core/frontend/rsbuild.config.ts
@@ -10,7 +10,7 @@ import { pluginBasicSsl } from '@rsbuild/plugin-basic-ssl'
import Components from 'unplugin-vue-components/rspack'
import AutoImport from 'unplugin-auto-import/rspack'
import { deployPlugin } from './build/plugin/deploy'
-import { getHttps, getProxyAddress, getServer, getEnv } from './build/utils'
+import { getEnv, getServer } from './build/utils'
const server = getServer()
@@ -22,7 +22,7 @@ export default defineConfig({
pluginVue(),
pluginVueJsx(),
pluginSass(),
- ...(getHttps() ? [pluginBasicSsl()] : []),
+ ...(server.https ? [pluginBasicSsl()] : []),
pluginEslint({
eslintPluginOptions: {
cwd: __dirname,
@@ -31,8 +31,8 @@ export default defineConfig({
},
}),
deployPlugin({
- host: server.ip,
- port: server.sshPort,
+ host: server.host,
+ port: server.port,
username: server.username,
password: server.password,
remoteDistPath: '/opt/billion-mail/core/public/dist',
@@ -79,7 +79,7 @@ export default defineConfig({
server: {
proxy: {
'/api': {
- target: getProxyAddress(),
+ target: server.address,
secure: false,
changeOrigin: true,
pathRewrite: { '^/api': '' },