Add halo configuration

pull/137/head
johnniang 2019-03-08 16:13:14 +08:00
parent 941189718c
commit bf65f63627
4 changed files with 39 additions and 2 deletions

View File

@ -0,0 +1,16 @@
package cc.ryanc.halo.config;
import cc.ryanc.halo.config.properties.HaloProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* Halo configuration.
*
* @author johnniang
*/
@Configuration
@EnableConfigurationProperties(HaloProperties.class)
public class HaloConfiguration {
}

View File

@ -0,0 +1,19 @@
package cc.ryanc.halo.config.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Halo configuration properties.
*
* @author johnniang
*/
@Data
@ConfigurationProperties("halo")
public class HaloProperties {
/**
* Doc api disabled. (Default is true)
*/
private Boolean docDisabled = true;
}

View File

@ -80,7 +80,7 @@ public class FrontPageController extends BaseController {
if (null == post || !post.getPostStatus().equals(PostStatusEnum.PUBLISHED.getCode())) {
return this.renderNotFound();
}
List<Comment> comments = null;
List<Comment> comments;
if (StrUtil.equals(OPTIONS.get(BlogPropertiesEnum.NEW_COMMENT_NEED_CHECK.getProp()), TrueFalseEnum.TRUE.getDesc()) || OPTIONS.get(BlogPropertiesEnum.NEW_COMMENT_NEED_CHECK.getProp()) == null) {
comments = commentService.findCommentsByPostAndCommentStatus(post, CommentStatusEnum.PUBLISHED.getCode());
} else {
@ -92,7 +92,7 @@ public class FrontPageController extends BaseController {
size = Integer.parseInt(OPTIONS.get(BlogPropertiesEnum.INDEX_COMMENTS.getProp()));
}
//评论分页
final ListPage<Comment> commentsPage = new ListPage<Comment>(CommentUtil.getComments(comments), cp, size);
final ListPage<Comment> commentsPage = new ListPage<>(CommentUtil.getComments(comments), cp, size);
final int[] rainbow = PageUtil.rainbow(cp, commentsPage.getTotalPage(), 3);
model.addAttribute("is_page", true);
model.addAttribute("post", post);

View File

@ -64,3 +64,5 @@ logging:
cc.ryanc.halo: DEBUG
org.hibernate: ERROR
file: ./logs/log.log
halo:
doc-disabled: false