-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.js
37 lines (29 loc) · 947 Bytes
/
setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require('fs')
const yml =(databaseurl, databaseuser, databasepwd)=> `
# spring.application.name=bcy
spring:
application:
name: 'bcy'
web:
resources:
static-locations: "classpath:/dist"
datasource:
url: ${databaseurl}
username: ${databaseuser}
password: ${databasepwd}
driver-class-name: 'com.mysql.cj.jdbc.Driver'
mybatis:
mapper-locations: classpath:/mapper/*.xml
server:
port: 8888
servlet:
encoding:
charset: 'UTF-8'
enabled: true
force: true
`
const argv = process.argv.slice(2)
const databaseurl = argv[0] || 'jdbc:mysql://localhost:3306/bcy'
const databaseuser = process.env.databaseuser || 'root'
const databasepwd = argv[1] || 'phpts'
fs.writeFileSync('./src/main/resources/application.yml', yml(databaseurl, databaseuser, databasepwd), 'utf8');