mirror of https://github.com/halo-dev/halo
parent
f21f5933bf
commit
49486198df
13
build.gradle
13
build.gradle
|
@ -39,10 +39,15 @@ configurations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bootJar {
|
|
||||||
manifest {
|
springBoot {
|
||||||
attributes("Implementation-Title": "Halo Application",
|
buildInfo()
|
||||||
"Implementation-Version": archiveVersion)
|
}
|
||||||
|
|
||||||
|
// gradle 的 Property Expansion 的占位符 ${..} 与 springboot 的占位符 冲突, springboot 的需要转义 \${..}
|
||||||
|
processResources {
|
||||||
|
filesMatching("application.yaml") {
|
||||||
|
expand(project.properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.boot.info.BuildProperties;
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -15,8 +16,10 @@ import run.halo.app.cache.AbstractStringCacheStore;
|
||||||
import run.halo.app.cache.InMemoryCacheStore;
|
import run.halo.app.cache.InMemoryCacheStore;
|
||||||
import run.halo.app.cache.LevelCacheStore;
|
import run.halo.app.cache.LevelCacheStore;
|
||||||
import run.halo.app.config.properties.HaloProperties;
|
import run.halo.app.config.properties.HaloProperties;
|
||||||
|
import run.halo.app.model.support.HaloConst;
|
||||||
import run.halo.app.utils.HttpClientUtils;
|
import run.halo.app.utils.HttpClientUtils;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import java.security.KeyManagementException;
|
import java.security.KeyManagementException;
|
||||||
import java.security.KeyStoreException;
|
import java.security.KeyStoreException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
@ -34,6 +37,9 @@ public class HaloConfiguration {
|
||||||
@Autowired
|
@Autowired
|
||||||
HaloProperties haloProperties;
|
HaloProperties haloProperties;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BuildProperties buildProperties;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
|
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
|
||||||
builder.failOnEmptyBeans(false);
|
builder.failOnEmptyBeans(false);
|
||||||
|
@ -70,4 +76,8 @@ public class HaloConfiguration {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
HaloConst.HALO_VERSION = buildProperties.getVersion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,6 @@ public class HaloConst {
|
||||||
*/
|
*/
|
||||||
public final static String DEFAULT_THEME_ID = "caicai_anatole";
|
public final static String DEFAULT_THEME_ID = "caicai_anatole";
|
||||||
|
|
||||||
/**
|
|
||||||
* Version constant. (Available in production environment)
|
|
||||||
*/
|
|
||||||
public static final String HALO_VERSION;
|
|
||||||
/**
|
/**
|
||||||
* Path separator.
|
* Path separator.
|
||||||
*/
|
*/
|
||||||
|
@ -143,8 +139,9 @@ public class HaloConst {
|
||||||
*/
|
*/
|
||||||
public static String USER_SESSION_KEY = "user_session";
|
public static String USER_SESSION_KEY = "user_session";
|
||||||
|
|
||||||
static {
|
/**
|
||||||
// Set version
|
* Version constant.
|
||||||
HALO_VERSION = HaloConst.class.getPackage().getImplementationVersion();
|
*/
|
||||||
}
|
public static String HALO_VERSION = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ spring:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 10240MB
|
max-file-size: 10240MB
|
||||||
max-request-size: 10240MB
|
max-request-size: 10240MB
|
||||||
location: ${java.io.tmpdir}
|
location: \${java.io.tmpdir}
|
||||||
management:
|
management:
|
||||||
endpoints:
|
endpoints:
|
||||||
web:
|
web:
|
||||||
|
@ -48,7 +48,10 @@ logging:
|
||||||
level:
|
level:
|
||||||
run.halo.app: INFO
|
run.halo.app: INFO
|
||||||
file:
|
file:
|
||||||
path: ${user.home}/.halo/logs
|
path: \${user.home}/.halo/logs
|
||||||
|
|
||||||
halo:
|
halo:
|
||||||
download-timeout: 5m
|
download-timeout: 5m
|
||||||
|
|
||||||
|
application:
|
||||||
|
version: ${version}
|
||||||
|
|
Loading…
Reference in New Issue