Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
4bc627817f build(deps): bump junit from 4.13.1 to 4.13.2
Bumps [junit](https://github.com/junit-team/junit4) from 4.13.1 to 4.13.2.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.13.1...r4.13.2)

---
updated-dependencies:
- dependency-name: junit:junit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-02 12:43:58 +00:00
8 changed files with 41 additions and 170 deletions

View File

@@ -131,7 +131,7 @@
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.13.1</version> <version>4.13.2</version>
</dependency> </dependency>
<!-- JJwt --> <!-- JJwt -->

View File

@@ -1,66 +0,0 @@
package cn.celess.blog.configuration;
import cn.celess.blog.util.EnvironmentUtil;
import org.jetbrains.annotations.NotNull;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.boot.logging.DeferredLog;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;
import java.util.regex.Matcher;
/**
* <p>date: 2022/12/02</P>
* <p>desc: </p>
* <p>mail: a@celess.cn</p>
*
* @author 禾几海
*/
@Component
public class CommonEnvPostProcessor implements EnvironmentPostProcessor, ApplicationListener<ApplicationEvent>, Ordered {
public static final DeferredLog log = new DeferredLog();
private static final String CONFIG_PATH = "/HBlog/config/blog.properties";
private static final String SOURCE_NAME = "localize";
@Override
public void postProcessEnvironment(ConfigurableEnvironment configurableEnvironment, SpringApplication springApplication) {
EnvironmentUtil.setEnvironment(configurableEnvironment);
log.info("加载本地配置文件--");
//获取环境变量
String homeEnv = EnvironmentUtil.getEnv("BLOG_HOME", EnvironmentUtil.getEnv("USERPROFILE"));
String configPath = (homeEnv + CONFIG_PATH).replaceAll("[\\|/]+", Matcher.quoteReplacement(File.separator));
try (InputStream input = Files.newInputStream(Paths.get(configPath))) {
Properties properties = new Properties();
properties.load(input);
PropertiesPropertySource propertySource = new PropertiesPropertySource(SOURCE_NAME, properties);
configurableEnvironment.getPropertySources().addLast(propertySource);
log.info("成功加载本地配置文件:)");
} catch (Exception e) {
log.info("加载本地[" + configPath + "]的配置文件失败:(");
}
}
@Override
public void onApplicationEvent(@NotNull ApplicationEvent event) {
log.replayTo(CommonEnvPostProcessor.class);
}
@Override
public int getOrder() {
return 0;
}
}

View File

@@ -37,17 +37,6 @@ public class CategoryController {
return Response.success(categoryService.delete(id)); return Response.success(categoryService.delete(id));
} }
/**
* 删除一个分类
*
* @param id 分类id
* @return Response
*/
@DeleteMapping("/admin/category/del/{id}")
public Response deleteOne(@PathVariable("id") long id) {
return Response.success(categoryService.delete(id));
}
/** /**
* 更新一个分类 * 更新一个分类
* *

View File

@@ -1,51 +0,0 @@
package cn.celess.blog.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment;
/**
* <p>date: 2022/12/02</P>
* <p>desc: </p>
* <p>mail: a@celess.cn</p>
*
* @author 禾几海
*/
@Slf4j
public class EnvironmentUtil {
private static Environment environment;
public static String getEnv(String name) {
String value = System.getenv(name);
if (StringUtils.isBlank(value)) {
log.error("没有找到环境变量:" + name);
}
return value;
}
public static String getEnv(String name, String defaultValue) {
String env = getEnv(name);
if (env == null) {
return defaultValue;
}
return env;
}
public static String getProperties(String key) {
String value = environment.getProperty(key);
if (StringUtils.isBlank(value)) {
log.error("没有找到配置项: {}", key);
}
return value;
}
public static String getProperties(String key, String defaultValue) {
return environment.getProperty(key, defaultValue);
}
public static void setEnvironment(Environment environment) {
EnvironmentUtil.environment = environment;
}
}

View File

@@ -1,2 +0,0 @@
org.springframework.boot.env.EnvironmentPostProcessor=cn.celess.blog.configuration.CommonEnvPostProcessor
org.springframework.context.ApplicationListener=cn.celess.blog.configuration.CommonEnvPostProcessor

View File

@@ -1,26 +1,26 @@
server.port=8081 server.port=8081
# ??????? # 七牛的密钥配置
qiniu.accessKey= qiniu.accessKey=
qiniu.secretKey= qiniu.secretKey=
qiniu.bucket= qiniu.bucket=
# sitemap ???? # sitemap 存放地址
sitemap.path= sitemap.path=
# ??JWT????? # 生成JWT时候的密钥
jwt.secret= jwt.secret=
spring.jpa.show-sql=false spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
# ????????? # 上传单个文件的大小
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=10MB
# ???????? # 上传文件的总大小
spring.servlet.multipart.max-request-size=10MB spring.servlet.multipart.max-request-size=10MB
##null????? ##null字段不显示
spring.jackson.default-property-inclusion=non_null spring.jackson.default-property-inclusion=non_null
################# ??? ################## ################# 数据库 ##################
#????????? #请先填写下面的配置
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url= spring.datasource.url=
spring.datasource.username= spring.datasource.username=
@@ -48,7 +48,7 @@ pagehelper.params=count=countSql
################ email ############## ################ email ##############
#??????????????????? #请先填写下面的配置,不然可能运行不起来
spring.mail.host= spring.mail.host=
spring.mail.username= spring.mail.username=
spring.mail.password= spring.mail.password=
@@ -62,7 +62,7 @@ spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFact
spring.mail.properties.mail.smtp.socketFactory.fallback=false spring.mail.properties.mail.smtp.socketFactory.fallback=false
#### ??nginx??? ????ip #### 用于nginx的代理 获取真实ip
server.use-forward-headers = true server.use-forward-headers = true
server.tomcat.remote-ip-header = X-Real-IP server.tomcat.remote-ip-header = X-Real-IP
server.tomcat.protocol-header = X-Forwarded-Proto server.tomcat.protocol-header = X-Forwarded-Proto
@@ -70,21 +70,21 @@ server.tomcat.protocol-header = X-Forwarded-Proto
############### redis ############## ############### redis ##############
# REDIS (RedisProperties) # REDIS (RedisProperties)
# Redis?????????0? # Redis数据库索引默认为0
spring.redis.database=0 spring.redis.database=0
# Redis????? # Redis服务器地址
spring.redis.host= spring.redis.host=
# Redis??????? # Redis服务器连接端口
spring.redis.port=6379 spring.redis.port=6379
# Redis????????????? # Redis服务器连接密码(默认为空)
spring.redis.password= spring.redis.password=
# ???????????????????? # 连接池最大连接数(使用负值表示没有限制)
spring.redis.jedis.pool.max-active=-1 spring.redis.jedis.pool.max-active=-1
# ??????????????????????? # 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
# ??????????? # 连接池中的最大空闲连接
spring.redis.jedis.pool.max-idle=8 spring.redis.jedis.pool.max-idle=8
# ??????????? # 连接池中的最小空闲连接
spring.redis.jedis.pool.min-idle=0 spring.redis.jedis.pool.min-idle=0
# ?????????? # 连接超时时间(毫秒)
spring.redis.timeout=5000 spring.redis.timeout=5000

View File

@@ -1,12 +1,12 @@
server.port=8081 server.port=8081
# ??????? # 七牛的密钥配置
qiniu.accessKey= qiniu.accessKey=
qiniu.secretKey= qiniu.secretKey=
qiniu.bucket= qiniu.bucket=
# sitemap ???? # sitemap 存放地址
sitemap.path= sitemap.path=
# ??JWT????? # 生成JWT时候的密钥
jwt.secret=sdaniod213k123123ipoeqowekqwe jwt.secret=sdaniod213k123123ipoeqowekqwe
##spring.jpa.show-sql=false ##spring.jpa.show-sql=false
@@ -14,15 +14,15 @@ jwt.secret=sdaniod213k123123ipoeqowekqwe
mybatis.type-handlers-package=cn.celess.blog.mapper.typehandler mybatis.type-handlers-package=cn.celess.blog.mapper.typehandler
logging.level.cn.celess.blog.mapper=debug logging.level.cn.celess.blog.mapper=debug
# ????????? # 上传单个文件的大小
spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-file-size=10MB
# ???????? # 上传文件的总大小
spring.servlet.multipart.max-request-size=10MB spring.servlet.multipart.max-request-size=10MB
spring.jackson.default-property-inclusion=non_null spring.jackson.default-property-inclusion=non_null
################# ??? ################## ################# 数据库 ##################
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#h2 #h2
@@ -51,7 +51,7 @@ pagehelper.params=count=countSql
#### ??nginx??? ????ip #### 用于nginx的代理 获取真实ip
server.use-forward-headers = true server.use-forward-headers = true
server.tomcat.remote-ip-header = X-Real-IP server.tomcat.remote-ip-header = X-Real-IP
server.tomcat.protocol-header = X-Forwarded-Proto server.tomcat.protocol-header = X-Forwarded-Proto
@@ -75,21 +75,22 @@ spring.mail.properties.mail.smtp.socketFactory.fallback=false
############### redis ############## ############### redis ##############
# REDIS (RedisProperties) # REDIS (RedisProperties)
# Redis?????????0? # Redis数据库索引默认为0
spring.redis.database=1 spring.redis.database=1
# Redis????? # Redis服务器地址
spring.redis.host=127.0.0.1 spring.redis.host=127.0.0.1
# Redis??????? ?????? ???????redis # Redis服务器连接端口 解决端口冲突 防止使用本地的redis
spring.redis.port=6380 spring.redis.port=6380
# Redis????????????? # Redis服务器连接密码(默认为空)
spring.redis.password= spring.redis.password=
# ???????????????????? # 连接池最大连接数(使用负值表示没有限制)
spring.redis.jedis.pool.max-active=-1 spring.redis.jedis.pool.max-active=-1
# ??????????????????????? # 连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.jedis.pool.max-wait=-1 spring.redis.jedis.pool.max-wait=-1
# ??????????? # 连接池中的最大空闲连接
spring.redis.jedis.pool.max-idle=8 spring.redis.jedis.pool.max-idle=8
# ??????????? # 连接池中的最小空闲连接
spring.redis.jedis.pool.min-idle=0 spring.redis.jedis.pool.min-idle=0
# ?????????? # 连接超时时间(毫秒)
spring.redis.timeout=5000 spring.redis.timeout=5000

View File

@@ -1,7 +1,7 @@
spring.profiles.active=dev spring.profiles.active=prod
#### ????? ####七牛的配置
####cn.celess.blog.service.serviceimpl.QiniuServiceImpl ####cn.celess.blog.service.serviceimpl.QiniuServiceImpl
logging.level.cn.celess.blog=debug logging.level.cn.celess.blog=debug
logging.level.cn.celess.blog.mapper=info logging.level.cn.celess.blog.mapper=info
## ??openSource ??-test ?????? -prod???????? ## 修改openSource 添加-test 文件用于测试 -prod文件用于线上发布