refactor: 安装向导移除「监听端口」字段
端口由启动方式(PM2 项目端口 / compose / API_PORT 环境变量)决定,默认 3000, 向导填的值会被进程环境覆盖,属误导项;写 .env 的 API_PORT 改取 process.env.API_PORT。 反代 HTTPS/域名仍由 Nginx/宝塔/1Panel 配置,与安装页无关。
This commit is contained in:
@@ -192,8 +192,7 @@
|
|||||||
"base": "Base",
|
"base": "Base",
|
||||||
"appName": "Platform Name",
|
"appName": "Platform Name",
|
||||||
"baseUrl": "Public URL",
|
"baseUrl": "Public URL",
|
||||||
"listenPort": "Listen Port",
|
"baseUrlHint": "All three apps share this URL: admin at /admin, client at /trace, API at /api. Reverse-proxy the domain and HTTPS to the service port (default 3000, decided by how the service is launched — not set here).",
|
||||||
"baseUrlHint": "All three apps share this URL: admin at /admin, client at /trace, API at /api. Use Nginx / a control panel to reverse-proxy the domain and HTTPS to the listen port.",
|
|
||||||
"host": "Host",
|
"host": "Host",
|
||||||
"port": "Port",
|
"port": "Port",
|
||||||
"database": "Database",
|
"database": "Database",
|
||||||
|
|||||||
@@ -192,8 +192,7 @@
|
|||||||
"base": "基础",
|
"base": "基础",
|
||||||
"appName": "平台名称",
|
"appName": "平台名称",
|
||||||
"baseUrl": "对外访问地址",
|
"baseUrl": "对外访问地址",
|
||||||
"listenPort": "监听端口",
|
"baseUrlHint": "三端共用此地址:后台 /admin、客户端 /trace、接口 /api。域名与 HTTPS 由 Nginx/宝塔/1Panel 反代到服务端口(默认 3000,由启动方式决定,此处无需填写)。",
|
||||||
"baseUrlHint": "三端共用此地址:后台 /admin、客户端 /trace、接口 /api。域名与 HTTPS 建议由 Nginx/宝塔/1Panel 反代到监听端口。",
|
|
||||||
"host": "主机",
|
"host": "主机",
|
||||||
"port": "端口",
|
"port": "端口",
|
||||||
"database": "数据库",
|
"database": "数据库",
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
<h2>{{ tt('base') }}</h2>
|
<h2>{{ tt('base') }}</h2>
|
||||||
<label><span>{{ tt('appName') }}</span><n-input v-model:value="form.appName" /></label>
|
<label><span>{{ tt('appName') }}</span><n-input v-model:value="form.appName" /></label>
|
||||||
<label><span>{{ tt('baseUrl') }}</span><n-input v-model:value="form.baseUrl" placeholder="https://example.com" /></label>
|
<label><span>{{ tt('baseUrl') }}</span><n-input v-model:value="form.baseUrl" placeholder="https://example.com" /></label>
|
||||||
<label><span>{{ tt('listenPort') }}</span><n-input-number v-model:value="form.port" :min="1" :show-button="false" class="full" /></label>
|
|
||||||
<p class="hint">{{ tt('baseUrlHint') }}</p>
|
<p class="hint">{{ tt('baseUrlHint') }}</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -100,7 +99,6 @@ import { useI18n } from 'vue-i18n';
|
|||||||
interface InstallForm {
|
interface InstallForm {
|
||||||
appName: string;
|
appName: string;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
port: number;
|
|
||||||
mysql: {
|
mysql: {
|
||||||
host: string;
|
host: string;
|
||||||
port: number;
|
port: number;
|
||||||
@@ -138,7 +136,6 @@ const driverOptions = computed(() => [
|
|||||||
const form = reactive<InstallForm>({
|
const form = reactive<InstallForm>({
|
||||||
appName: tt('defaultAppName'),
|
appName: tt('defaultAppName'),
|
||||||
baseUrl: location.origin,
|
baseUrl: location.origin,
|
||||||
port: 3000,
|
|
||||||
mysql: {
|
mysql: {
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 3306,
|
port: 3306,
|
||||||
@@ -223,7 +220,6 @@ onMounted(async () => {
|
|||||||
const body = await res.json();
|
const body = await res.json();
|
||||||
installed.value = Boolean(body.data?.installed);
|
installed.value = Boolean(body.data?.installed);
|
||||||
const d = body.data?.defaults || {};
|
const d = body.data?.defaults || {};
|
||||||
form.port = d.port || form.port;
|
|
||||||
form.mysql.host = d.mysqlHost || form.mysql.host;
|
form.mysql.host = d.mysqlHost || form.mysql.host;
|
||||||
form.mysql.port = d.mysqlPort || form.mysql.port;
|
form.mysql.port = d.mysqlPort || form.mysql.port;
|
||||||
form.mysql.database = d.mysqlDatabase || form.mysql.database;
|
form.mysql.database = d.mysqlDatabase || form.mysql.database;
|
||||||
|
|||||||
@@ -158,18 +158,11 @@ export class InstallRequestDto {
|
|||||||
appName!: string;
|
appName!: string;
|
||||||
|
|
||||||
// 对外访问地址(域名,可含端口);后台、客户端、短链、二维码均基于此推导。
|
// 对外访问地址(域名,可含端口);后台、客户端、短链、二维码均基于此推导。
|
||||||
|
// 服务监听端口不在此处填写:由启动方式(PM2 项目端口 / compose / API_PORT 环境变量)决定,默认 3000。
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@IsUrl({ require_tld: false })
|
@IsUrl({ require_tld: false })
|
||||||
baseUrl!: string;
|
baseUrl!: string;
|
||||||
|
|
||||||
// 服务监听端口(默认 3000),由前置 Nginx/宝塔/1Panel 反代指向该端口。
|
|
||||||
@ApiPropertyOptional({ default: 3000 })
|
|
||||||
@IsOptional()
|
|
||||||
@Type(() => Number)
|
|
||||||
@IsInt()
|
|
||||||
@Min(1)
|
|
||||||
port?: number;
|
|
||||||
|
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@ValidateNested()
|
@ValidateNested()
|
||||||
@Type(() => InstallMysqlDto)
|
@Type(() => InstallMysqlDto)
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export class InstallService {
|
|||||||
redisHost: process.env.INSTALL_REDIS_HOST || '127.0.0.1',
|
redisHost: process.env.INSTALL_REDIS_HOST || '127.0.0.1',
|
||||||
redisPort: Number(process.env.INSTALL_REDIS_PORT || 6379),
|
redisPort: Number(process.env.INSTALL_REDIS_PORT || 6379),
|
||||||
redisPassword: prefillSecrets ? process.env.INSTALL_REDIS_PASSWORD || '' : '',
|
redisPassword: prefillSecrets ? process.env.INSTALL_REDIS_PASSWORD || '' : '',
|
||||||
port: Number(process.env.API_PORT || 3000),
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -192,8 +191,8 @@ export class InstallService {
|
|||||||
'# ===== 应用 =====',
|
'# ===== 应用 =====',
|
||||||
`APP_NAME=${q(dto.appName)}`,
|
`APP_NAME=${q(dto.appName)}`,
|
||||||
'NODE_ENV=production',
|
'NODE_ENV=production',
|
||||||
'# 服务监听端口(由前置 Nginx/宝塔反代指向此端口)',
|
'# 服务监听端口:由启动方式决定(PM2 项目端口 / compose / API_PORT 环境变量),默认 3000',
|
||||||
`API_PORT=${q(String(dto.port || 3000))}`,
|
`API_PORT=${q(String(process.env.API_PORT || 3000))}`,
|
||||||
'# 对外访问地址:三端共用,客户端在 /trace、后台 /admin、接口 /api、短链 /t',
|
'# 对外访问地址:三端共用,客户端在 /trace、后台 /admin、接口 /api、短链 /t',
|
||||||
`BASE_URL=${q(baseUrl)}`,
|
`BASE_URL=${q(baseUrl)}`,
|
||||||
'PUBLIC_TRACE_PATH=/t',
|
'PUBLIC_TRACE_PATH=/t',
|
||||||
|
|||||||
Reference in New Issue
Block a user