Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
智布道
OneBlog
提交
f696b9dc
O
OneBlog
项目概览
智布道
/
OneBlog
9 个月 前同步成功
通知
11
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneBlog
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f696b9dc
编写于
8月 27, 2021
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🔧
增加 oneblog version 参数,能显示当前使用的版本
上级
a0f16c0d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
70 addition
and
24 deletion
+70
-24
blog-core/src/main/java/com/zyd/blog/framework/config/FreeMarkerConfig.java
.../java/com/zyd/blog/framework/config/FreeMarkerConfig.java
+4
-0
blog-core/src/main/java/com/zyd/blog/framework/property/AppProperties.java
...n/java/com/zyd/blog/framework/property/AppProperties.java
+18
-1
blog-core/src/main/java/com/zyd/blog/framework/runner/BlogApplicationRunner.java
.../com/zyd/blog/framework/runner/BlogApplicationRunner.java
+6
-6
blog-core/src/main/resources/config/application-center.yml
blog-core/src/main/resources/config/application-center.yml
+41
-16
blog-web/src/main/resources/templates/layout/footer.ftl
blog-web/src/main/resources/templates/layout/footer.ftl
+1
-1
未找到文件。
blog-core/src/main/java/com/zyd/blog/framework/config/FreeMarkerConfig.java
浏览文件 @
f696b9dc
...
...
@@ -2,6 +2,7 @@ package com.zyd.blog.framework.config;
import
com.jagregory.shiro.freemarker.ShiroTags
;
import
com.zyd.blog.business.service.SysConfigService
;
import
com.zyd.blog.framework.property.AppProperties
;
import
com.zyd.blog.framework.tag.ArticleTags
;
import
com.zyd.blog.framework.tag.CustomTags
;
import
freemarker.template.TemplateModelException
;
...
...
@@ -29,6 +30,8 @@ public class FreeMarkerConfig {
protected
ArticleTags
articleTags
;
@Autowired
private
SysConfigService
configService
;
@Autowired
private
AppProperties
appProperties
;
/**
* 添加自定义标签
...
...
@@ -39,6 +42,7 @@ public class FreeMarkerConfig {
configuration
.
setSharedVariable
(
"articleTag"
,
articleTags
);
try
{
configuration
.
setSharedVariable
(
"config"
,
configService
.
getConfigs
());
configuration
.
setSharedVariable
(
"appInfo"
,
appProperties
);
//shiro标签
configuration
.
setSharedVariable
(
"shiro"
,
new
ShiroTags
());
}
catch
(
TemplateModelException
e
)
{
...
...
blog-core/src/main/java/com/zyd/blog/framework/property/AppProperties.java
浏览文件 @
f696b9dc
...
...
@@ -19,6 +19,23 @@ public class AppProperties {
/**
* 是否启用验证码
*/
public
boolean
enableKaptcha
=
false
;
private
boolean
enableKaptcha
=
false
;
/**
* 是否在项目启动时,打印配置文件中的 【数据库配置】,包括 mysql、redis,默认关闭,生产环境不建议开启
*/
private
boolean
enabledPrintConfig
;
/**
* 是否启用 redis 切面缓存。
* <p>
* 优先级高于 {@link com.zyd.blog.business.annotation.RedisCache#enable()} 配置
*/
private
boolean
enableRedisCache
;
/**
* 系统版本,不建议修改。有 OneBlog 作者定时更新
*/
private
String
version
;
}
blog-core/src/main/java/com/zyd/blog/framework/runner/BlogApplicationRunner.java
浏览文件 @
f696b9dc
package
com.zyd.blog.framework.runner
;
import
com.zyd.blog.framework.property.AppProperties
;
import
com.zyd.blog.framework.property.RedisProperties
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -30,10 +31,8 @@ public class BlogApplicationRunner extends ContextLoaderListener implements Appl
@Value
(
"${server.port}"
)
private
int
port
;
@Value
(
"${spring.profiles.active}"
)
private
String
profile
;
@Value
(
"${app.enabledConfigLog}"
)
private
Boolean
enabledConfigLog
;
@Autowired
private
AppProperties
appProperties
;
@Autowired
private
DataSourceProperties
dataSourceProperties
;
...
...
@@ -50,8 +49,9 @@ public class BlogApplicationRunner extends ContextLoaderListener implements Appl
@Override
public
void
contextInitialized
(
ServletContextEvent
event
)
{
if
(
null
!=
enabledConfigLog
&&
enabledConfigLog
)
{
log
.
info
(
"博客关键配置信息:"
);
log
.
info
(
"博客关键配置信息:"
);
log
.
info
(
"current version:{}"
,
appProperties
.
getVersion
());
if
(
appProperties
.
isEnabledConfigLog
())
{
String
[]
activeProfiles
=
configurableApplicationContext
.
getEnvironment
().
getActiveProfiles
();
if
(
ObjectUtils
.
isEmpty
(
activeProfiles
))
{
String
[]
defaultProfiles
=
configurableApplicationContext
.
getEnvironment
().
getDefaultProfiles
();
...
...
blog-core/src/main/resources/config/application-center.yml
浏览文件 @
f696b9dc
spring
:
####### database Config #######
datasource
:
druid
:
connection-init-sqls
:
set names utf8mb4
driver-class-name
:
com.mysql.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://${ONEBLOG_DATASOURCE_HOST:127.0.0.1}:${ONEBLOG_DATASOURCE_PORT:3306}/${ONEBLOG_DATASOURCE_DATABASE_NAME:dblog}?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true
username
:
${ONEBLOG_DATASOURCE_USERNAME:root}
password
:
${ONEBLOG_DATASOURCE_PASSWORD:root}
####### Redis Config #######
redis
:
database
:
${ONEBLOG_REDIS_DATABASE_INDEX:1}
# Redis服务器地址
host
:
${ONEBLOG_REDIS_HOST:127.0.0.1}
# Redis服务器连接端口
port
:
${ONEBLOG_REDIS_PORT:6379}
# Redis服务器连接密码(默认为空)
password
:
${ONEBLOG_REDIS_PASSWORD:123456ZHYD}
jedis
:
pool
:
# 连接池最大连接数(使用负值表示没有限制)
max-active
:
8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池中的最大空闲连接
max-idle
:
8
# 连接池中的最小空闲连接
min-idle
:
0
# 连接超时时间(毫秒)
timeout
:
5000ms
# 默认的数据过期时间,主要用于shiro权限管理
expire
:
2592000
####### redis缓存服务配置 #######
session
:
store-type
:
redis
# 指定默认MimeMessage的编码,默认为: UTF-8
mail
:
default-encoding
:
UTF-8
...
...
@@ -24,19 +61,7 @@ spring:
mail.smtp.connectiontimeout
:
50000
mail.smtp.timeout
:
30000
mail.smtp.writetimeout
:
50000
# Redis数据库索引(默认为0)
redis
:
jedis
:
pool
:
# 连接池最大连接数(使用负值表示没有限制)
max-active
:
8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
# 连接池中的最大空闲连接
max-idle
:
8
# 连接池中的最小空闲连接
min-idle
:
0
# 连接超时时间(毫秒)
timeout
:
5000ms
# 默认的数据过期时间,主要用于shiro权限管理
expire
:
2592000
app
:
version
:
v2.2.7
enableRedisCache
:
false
blog-web/src/main/resources/templates/layout/footer.ftl
浏览文件 @
f696b9dc
...
...
@@ -131,7 +131,7 @@
<div class="container">
<div class="row">
<div class="col col-xs-12 col-md-12 col-lg-12">
<p><#if config.copyright!>${config.copyright} |</#if> Powered by <a href="https://gitee.com/yadong.zhang/DBlog" title="OneBlog是一款简洁美观、自适应的Java博客系统..." data-toggle="tooltip" data-placement="right" target="_blank"
><i>OneBlog</i>
</a> </p>
<p><#if config.copyright!>${config.copyright} |</#if> Powered by <a href="https://gitee.com/yadong.zhang/DBlog" title="OneBlog是一款简洁美观、自适应的Java博客系统..." data-toggle="tooltip" data-placement="right" target="_blank"
style="color: #4286ca;font-weight: 600;">OneBlog ${appInfo.version!}
</a> </p>
<#if url?? && (url == "index")>
<div class="inline external-links">
<a>友情链接:</a>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录