From a936113709dfa3d65321dcebfd26fed16d873183 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E7=B2=BE=E5=8D=8E?= <842761733@qq.com>
Date: Mon, 3 Jul 2023 14:34:40 +0800
Subject: [PATCH] new config item support environment config
---
server/pom.xml | 2 +-
server/src/main/config/application.properties | 14 +++++++-------
.../java/cn/keking/config/ConfigConstants.java | 16 ++++++++--------
.../cn/keking/config/ConfigRefreshComponent.java | 6 +++---
.../cn/keking/web/filter/AttributeSetFilter.java | 2 +-
server/src/main/resources/web/main/index.ftl | 16 +++++++---------
6 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/server/pom.xml b/server/pom.xml
index 32ba0c7da..58eb513d6 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -336,7 +336,7 @@
false
-
+ src/main/assembly/dist-win32.xml
src/main/assembly/dist-linux.xml
diff --git a/server/src/main/config/application.properties b/server/src/main/config/application.properties
index 3d4e7445c..b3e4721a6 100644
--- a/server/src/main/config/application.properties
+++ b/server/src/main/config/application.properties
@@ -120,15 +120,15 @@ watermark.angle = ${WATERMARK_ANGLE:10}
#Tif类型图片浏览模式:tif(利用前端js插件浏览);jpg(转换为jpg后前端显示);pdf(转换为pdf后显示,便于打印)
tif.preview.type = ${KK_TIF_PREVIEW_TYPE:tif}
-# 备案信息
-beiAn =
+# 备案信息,默认为空
+beian = ${KK_BEIAN:default}
#禁止上传类型
-prohibit = exe,dll,dat
+prohibit = ${KK_PROHIBIT:exe,dll,dat}
#删除密码
-delete.password = 123456
+delete.password = ${KK_DELETE_PASSWORD:123456}
#删除 转换后OFFICE、CAD、TIFF、压缩包源文件 默认开启 节约磁盘空间
-delete.source.file = true
+delete.source.file = ${KK_DELETE_SOURCE_FILE:true}
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
-pdf2jpg.dpi = 144
+pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
#xlsx格式前端解析
-office.type.web = web
\ No newline at end of file
+office.type.web = ${KK_OFFICE_TYPE_WEB:web}
\ No newline at end of file
diff --git a/server/src/main/java/cn/keking/config/ConfigConstants.java b/server/src/main/java/cn/keking/config/ConfigConstants.java
index 32a94e63d..820d117dd 100644
--- a/server/src/main/java/cn/keking/config/ConfigConstants.java
+++ b/server/src/main/java/cn/keking/config/ConfigConstants.java
@@ -42,7 +42,7 @@ public class ConfigConstants {
private static String pdfBookmarkDisable;
private static Boolean fileUploadDisable;
private static String tifPreviewType;
- private static String beiAn;
+ private static String beian;
private static String[] prohibit = {};
private static String size;
private static String password;
@@ -368,15 +368,15 @@ public static void setTifPreviewTypeValue(String tifPreviewType) {
ConfigConstants.tifPreviewType = tifPreviewType;
}
- public static String getBeiAn() {
- return beiAn;
+ public static String getBeian() {
+ return beian;
}
- @Value("${beiAn:无}")
- public void setBeiAn(String beiAn) {
- setBeiAnValue(beiAn);
+ @Value("${beian:default}")
+ public void setBeian(String beian) {
+ setBeianValue(beian);
}
- public static void setBeiAnValue(String beiAn) {
- ConfigConstants.beiAn = beiAn;
+ public static void setBeianValue(String beian) {
+ ConfigConstants.beian = beian;
}
public static String[] getProhibit() {
return prohibit;
diff --git a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java
index 82bbcd5ae..b03ff1f05 100644
--- a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java
+++ b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java
@@ -55,7 +55,7 @@ public void run() {
String tifPreviewType;
String prohibit;
String[] prohibitArray;
- String beiAn;
+ String beian;
String size;
String password;
int pdf2JpgDpi;
@@ -86,7 +86,7 @@ public void run() {
fileUploadDisable = Boolean.parseBoolean(properties.getProperty("file.upload.disable", ConfigConstants.DEFAULT_FILE_UPLOAD_DISABLE));
tifPreviewType = properties.getProperty("tif.preview.type", ConfigConstants.DEFAULT_TIF_PREVIEW_TYPE);
size = properties.getProperty("spring.servlet.multipart.max-file-size", ConfigConstants.DEFAULT_SIZE);
- beiAn = properties.getProperty("beiAn", ConfigConstants.DEFAULT_BEIAN);
+ beian = properties.getProperty("beian", ConfigConstants.DEFAULT_BEIAN);
prohibit = properties.getProperty("prohibit", ConfigConstants.DEFAULT_PROHIBIT);
password = properties.getProperty("delete.password", ConfigConstants.DEFAULT_PASSWORD);
pdf2JpgDpi = Integer.parseInt(properties.getProperty("pdf2jpg.dpi", ConfigConstants.DEFAULT_PDF2_JPG_DPI));
@@ -111,7 +111,7 @@ public void run() {
ConfigConstants.setPdfBookmarkDisableValue(pdfBookmarkDisable);
ConfigConstants.setFileUploadDisableValue(fileUploadDisable);
ConfigConstants.setTifPreviewTypeValue(tifPreviewType);
- ConfigConstants.setBeiAnValue(beiAn);
+ ConfigConstants.setBeianValue(beian);
ConfigConstants.setSizeValue(size);
ConfigConstants.setProhibitValue(prohibitArray);
ConfigConstants.setPasswordValue(password);
diff --git a/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java b/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java
index 7040d7e00..54fab9832 100644
--- a/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java
+++ b/server/src/main/java/cn/keking/web/filter/AttributeSetFilter.java
@@ -40,7 +40,7 @@ private void setFileAttribute(ServletRequest request){
request.setAttribute("fileKey", httpRequest.getParameter("fileKey"));
request.setAttribute("switchDisabled", ConfigConstants.getOfficePreviewSwitchDisabled());
request.setAttribute("fileUploadDisable", ConfigConstants.getFileUploadDisable());
- request.setAttribute("beiAn", ConfigConstants.getBeiAn());
+ request.setAttribute("beian", ConfigConstants.getBeian());
request.setAttribute("size", ConfigConstants.maxSize());
}
diff --git a/server/src/main/resources/web/main/index.ftl b/server/src/main/resources/web/main/index.ftl
index 7e56d68d4..b4f5408f5 100644
--- a/server/src/main/resources/web/main/index.ftl
+++ b/server/src/main/resources/web/main/index.ftl
@@ -154,11 +154,13 @@
-
-
-
${beiAn}
+<#if beian?? && beian != "default">
+
-
+#if>