Skip to content

Commit aabf9df

Browse files
committed
保护所有配置文件,使用环境变量管理敏感信息
1 parent 836a225 commit aabf9df

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

.github/workflows/deploy.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,20 @@ jobs:
5252
script: |
5353
cd /opt/TinyFlow
5454
git pull origin master
55-
55+
5656
# 重新构建前端
5757
cd web
5858
npm ci
5959
npm run build
60-
60+
6161
# 重新构建后端
6262
cd ..
6363
mvn clean package -DskipTests
64-
65-
# 重启服务
64+
65+
# 重启服务(自动加载环境变量)
6666
systemctl restart tinyflow
67-
systemctl restart nginx
68-
69-
echo " 部署完成!"
67+
68+
echo "✅ 部署完成!"
7069
7170
# 7. 部署成功通知(可选)
7271
- name: Deployment Success

src/main/resources/application.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spring:
88
datasource:
99
url: jdbc:mysql://localhost:3306/tiny-flow?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&connectionCollation=utf8mb4_unicode_ci
1010
username: root
11-
password: CHANGE_ME_DB_PASSWORD
11+
password: ${DB_PASSWORD}
1212
driver-class-name: com.mysql.cj.jdbc.Driver
1313
hikari:
1414
maximum-pool-size: 100
@@ -26,7 +26,7 @@ spring:
2626
redis:
2727
host: 47.97.110.128
2828
port: 6379
29-
password: 123456
29+
password: ${REDIS_PASSWORD}
3030
timeout: 2s
3131
lettuce:
3232
pool:
@@ -82,7 +82,7 @@ server:
8282

8383

8484
app:
85-
domain: http://47.97.110.128
85+
domain: ${APP_DOMAIN}
8686

8787
shortcode:
8888
minLen: 4
@@ -213,6 +213,6 @@ resilience4j:
213213
# JWT 配置
214214
jwt:
215215
# 密钥(生产环境请使用环境变量或加密存储,至少256位)
216-
secret: CHANGE_ME_SECRET_KEY
216+
secret: ${JWT_SECRET}
217217
# 过期时间(毫秒),默认7天
218218
expiration: 604800000

0 commit comments

Comments
 (0)