Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nuxt-backend-helper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王曜嵚 Wang Yaoqin
nuxt-backend-helper
Commits
48199965
Commit
48199965
authored
Dec 02, 2024
by
王曜嵚 Wang Yaoqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复配置没有同步的问题
parent
4ceea4c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
85 deletions
+129
-85
README.md
README.md
+16
-75
server.ts
server/utils/server.ts
+10
-10
test.js
test.js
+103
-0
No files found.
README.md
View file @
48199965
# Nuxt 3 Minimal Starter
## 安装
使用
`node`
20 及以上版本安装
Look at the
[
Nuxt 3 documentation
](
https://nuxt.com/docs/getting-started/introduction
)
to learn more.
## 部署
## Setup
1.
运行
`npm run build`
命令后得到
`output`
文件夹
Make sure to install the dependencies:
2.
进入
`output`
文件夹,运行启动命令
`node ./server/index.mjs`
,node命令必须具有以下参数
*
`NUXT_PG_HOST`
: Postgres 数据库地址
```
bash
*
`NUXT_PG_PORT`
: Postgres 数据库端口
# npm
*
`NUXT_PG_PASSWORD`
: Postgres 数据库密码
npm
install
*
`NUXT_PG_DATABASE`
: Postgres 数据库名称
*
`NUXT_PUBLIC_DOCKER_HOST`
: 公开容器地址
# pnpm
*
`PORT`
: 服务端口
pnpm
install
## 使用
# yarn
初次运行后,会检查 Postgres 数据库是否安装,未安装则执行安装步骤。安装完成后,可以进入
`localhost:PORT`
地址查看服务内容
yarn
install
# bun
bun
install
```
## Development Server
Start the development server on
`http://localhost:3000`
:
```
bash
# npm
npm run dev
# pnpm
pnpm run dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```
bash
# npm
npm run build
# pnpm
pnpm run build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```
bash
# npm
npm run preview
# pnpm
pnpm run preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the
[
deployment documentation
](
https://nuxt.com/docs/getting-started/deployment
)
for more information.
server/utils/server.ts
View file @
48199965
...
@@ -87,11 +87,11 @@ export async function copyAndCreateServerPropertiesV2InDocker (username: string)
...
@@ -87,11 +87,11 @@ export async function copyAndCreateServerPropertiesV2InDocker (username: string)
// user personal config
// user personal config
const customServerProperties: { key: string, value: string }[] = userConfigs!.serverProperties || []
const customServerProperties: { key: string, value: string }[] = userConfigs!.serverProperties || []
customServerProperties.forEach(item => {
customServerProperties.forEach(item => {
const RegExpKey = item.key.replaceAll('[', '\\[').replaceAll(']', '\\]').replace('.', '\\.')
const RegExpKey = item.key.replaceAll('[', '\\[').replaceAll(']', '\\]').replace
All
('.', '\\.')
if (backendText.match(new RegExp(`
#
$
{
RegExpKey
}
=
(.
*
?)
\
n
`))) {
if (backendText.match(new RegExp(`
#
$
{
RegExpKey
}
=
(.
*
?)
\
r
?
\
n
`))) {
backendText = backendText.replace(new RegExp(`
#
$
{
RegExpKey
}
=
(.
*
?)
\
n
`), `
$
{
item
.
key
}
=
$
{
item
.
value
}
\
n
`)
backendText = backendText.replace(new RegExp(`
#
$
{
RegExpKey
}
=
(.
*
?)
\
r
?
\
n
`), `
$
{
item
.
key
}
=
$
{
item
.
value
}
\
n
`)
} else if (backendText.match(new RegExp(`
$
{
RegExpKey
}
=
(.
*
?)
\
n
`))) {
} else if (backendText.match(new RegExp(`
$
{
RegExpKey
}
=
(.
*
?)
\
r
?
\
n
`))) {
backendText = backendText.replace(new RegExp(`
$
{
RegExpKey
}
=
(.
*
?)
\
n
`), `
$
{
item
.
key
}
=
$
{
item
.
value
}
\
n
`)
backendText = backendText.replace(new RegExp(`
$
{
RegExpKey
}
=
(.
*
?)
\
r
?
\
n
`), `
$
{
item
.
key
}
=
$
{
item
.
value
}
\
n
`)
} else { // 如果完全没有匹配到内容,则直接追加到最后
} else { // 如果完全没有匹配到内容,则直接追加到最后
backendText += `
\
n$
{
item
.
key
}
=
$
{
item
.
value
}
\
n
`
backendText += `
\
n$
{
item
.
key
}
=
$
{
item
.
value
}
\
n
`
}
}
...
@@ -135,11 +135,11 @@ export async function copyAndCreateServerPropertiesV1InDocker (username: string)
...
@@ -135,11 +135,11 @@ export async function copyAndCreateServerPropertiesV1InDocker (username: string)
// user personal config
// user personal config
const
customServerProperties
:
{
key
:
string
,
value
:
string
}[]
=
userConfigs
!
.
serverProperties
||
[]
const
customServerProperties
:
{
key
:
string
,
value
:
string
}[]
=
userConfigs
!
.
serverProperties
||
[]
customServerProperties
.
forEach
(
item
=>
{
customServerProperties
.
forEach
(
item
=>
{
const
RegExpKey
=
item
.
key
.
replaceAll
(
'['
,
'
\\
['
).
replaceAll
(
']'
,
'
\\
]'
).
replace
(
'.'
,
'
\\
.'
)
const
RegExpKey
=
item
.
key
.
replaceAll
(
'['
,
'
\\
['
).
replaceAll
(
']'
,
'
\\
]'
).
replace
All
(
'.'
,
'
\\
.'
)
if
(
backendText
.
match
(
new
RegExp
(
`#
${
RegExpKey
}
=(.*?)\n`
)))
{
if
(
backendText
.
match
(
new
RegExp
(
`#
${
RegExpKey
}
=(.*?)\
r?\
n`
)))
{
backendText
=
backendText
.
replace
(
new
RegExp
(
`#
${
RegExpKey
}
=(.*?)\n`
),
`
${
item
.
key
}
=
${
item
.
value
}
\n`
)
backendText
=
backendText
.
replace
(
new
RegExp
(
`#
${
RegExpKey
}
=(.*?)\
r?\
n`
),
`
${
item
.
key
}
=
${
item
.
value
}
\n`
)
}
else
if
(
backendText
.
match
(
new
RegExp
(
`
${
RegExpKey
}
=(.*?)\n`
)))
{
}
else
if
(
backendText
.
match
(
new
RegExp
(
`
${
RegExpKey
}
=(.*?)\
r?\
n`
)))
{
backendText
=
backendText
.
replace
(
new
RegExp
(
`
${
RegExpKey
}
=(.*?)\n`
),
`
${
item
.
key
}
=
${
item
.
value
}
\n`
)
backendText
=
backendText
.
replace
(
new
RegExp
(
`
${
RegExpKey
}
=(.*?)\
r?\
n`
),
`
${
item
.
key
}
=
${
item
.
value
}
\n`
)
}
else
{
// 如果完全没有匹配到内容,则直接追加到最后
}
else
{
// 如果完全没有匹配到内容,则直接追加到最后
backendText
+=
`\n
${
item
.
key
}
=
${
item
.
value
}
\n`
backendText
+=
`\n
${
item
.
key
}
=
${
item
.
value
}
\n`
}
}
...
...
test.js
0 → 100644
View file @
48199965
let
backendText
=
`# 数据库连接 url
spring.datasource.url=jdbc:postgresql://192.168.0.4:25556/wyq
# 数据库连接用户名
spring.datasource.username=postgres
# 数据连接密码
spring.datasource.password=postgres
# 数据库连接驱动
spring.datasource.driver-class-name=org.postgresql.Driver
# 数据库连接池
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
# 连接池最小连接数
spring.datasource.hikari.minimum-idle=5
# 连接池最大连接数
spring.datasource.hikari.maximum-pool-size=50
# 连接建立超时时间
spring.datasource.hikari.connection-timeout=3000
# redis 数据库默认使用db0
spring.redis.database=0
# redis 密码
spring.redis.password=
# redis 端口
spring.redis.port=6379
# redis host
spring.redis.host=192.168.0.4
# 连接超时时间(单位:毫秒)
spring.redis.timeout=3000
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.lettuce.pool.max-active=20
# 连接池中的最小空闲连接
spring.redis.lettuce.pool.min-idle=10
# 连接池中的最大空闲连接
spring.redis.lettuce.pool.max-idle=10
# 连接池最大阻塞等待时间(单位:毫秒,使用负值表示没有限制)
spring.redis.lettuce.pool.max-wait=1000
# 在关闭客户端连接之前等待任务处理完成的最长时间(单位:毫秒),在这之后,无论任务是否执行完成,都会被执行器关闭,默认100ms
spring.redis.lettuce.shutdown-timeout=100
# 是否缓存空值
spring.cache.redis.cache-null-values=false
# 日志相关配置
logging.level.org.springframework=INFO
logging.level.io.netty=INFO
logging.level.com.zaxxer.hikari=INFO
logging.level.com.alibaba.excel=INFO
logging.level.io.lettuce=INFO
logging.level.org.hibernate=INFO
logging.level.org.eclipse=INFO
logging.level.org.apache.zookeeper=INFO
logging.level.org.apache.http=INFO
logging.level.org.elasticsearch=INFO
logging.level.com.obs=INFO
logging.level.org.quartz.core=INFO
logging.level.net.sf.jasperreports=INFO
logging.level.logwire=DEBUG
logging.level.org.springframework.boot.autoconfigure.logging=error
# MQ 相关配置
# MQ name service address; 默认值:localhost:9876
logwire.mq.name-srv-address=192.168.0.4:9876
# Backend 服务端口; 默认值:8091
logwire.server-port=9001
# 前端资源路径; 默认值:./frontend
logwire.frontend-path=./frontend
# 环境类型; 默认值:dev; 可选值:dev; uat; prod;
logwire.environment-type=dev
# 是否开启 CSRF 校验; 默认值:true
logwire.csrf-check-enabled=true
# 注册中心地址; 默认值:127.0.0.1:2181
logwire.register-center-server-list=192.168.0.4:2181
# 共享线程池大小; 默认值:C*2
logwire.shared-thread-pool-size=
# 检测到白名单之外的代码时是否抛出异常; 默认值:false
logwire.java-files-check-enabled=false
# Document 配置
# 是否开启客户端直连文件存储服务器; 默认值:false
logwire.document.client-direct-access-storage-service=false
# 文件存储服务器类型; 默认值:db; 可选值:db; obs; oss; azure-blob; aws-s3; dir;
logwire.document.storage-type=obs
# 当 storage-type 类型为 dir 时,配置该参数,值为文件存储目录
logwire.document.storage-dir=
logwire.document.obs.bucket-name=saas-platform-dev
logwire.document.obs.end-point=obs.cn-east-2.myhuaweicloud.com
logwire.document.obs.access-key=EFM5GPM1R9JOJYHE5VM6
logwire.document.obs.secret-key=7SaE5ZiADGywxWcJSvYEqr5nLgh2dcfG1Bm08bIk
# 华为云 OBS 相关配置
`
// user personal config
const
customServerProperties
=
[{
key
:
'logwire.document.storage-type'
,
value
:
'ob2222s'
}]
customServerProperties
.
forEach
(
item
=>
{
const
RegExpKey
=
item
.
key
.
replaceAll
(
'['
,
'
\\
['
).
replaceAll
(
']'
,
'
\\
]'
).
replaceAll
(
'.'
,
'
\\
.'
)
if
(
backendText
.
match
(
new
RegExp
(
`#
${
RegExpKey
}
=(.*?)\n`
)))
{
backendText
=
backendText
.
replace
(
new
RegExp
(
`#
${
RegExpKey
}
=(.*?)\n`
),
`
${
item
.
key
}
=
${
item
.
value
}
\n`
)
}
else
if
(
backendText
.
match
(
new
RegExp
(
`
${
RegExpKey
}
=(.*?)\n`
)))
{
backendText
=
backendText
.
replace
(
new
RegExp
(
`
${
RegExpKey
}
=(.*?)\n`
),
`
${
item
.
key
}
=
${
item
.
value
}
\n`
)
}
else
{
// 如果完全没有匹配到内容,则直接追加到最后
backendText
+=
`\n
${
item
.
key
}
=
${
item
.
value
}
\n`
}
})
console
.
log
(
backendText
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment