fix: rollback #714 pull request. (#838)

pull/846/head
Ryan Wang 2020-05-12 11:49:40 +08:00 committed by GitHub
parent 4197ca33d8
commit e7addd41f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 36 deletions

View File

@ -40,14 +40,10 @@ configurations {
} }
springBoot { bootJar {
buildInfo() manifest {
} attributes("Implementation-Title": "Halo Application",
"Implementation-Version": archiveVersion)
// gradle Property Expansion ${..} springboot springboot \${..}
processResources {
filesMatching("application.yaml") {
expand(project.properties)
} }
} }

View File

@ -5,7 +5,6 @@ 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;
@ -17,10 +16,8 @@ import run.halo.app.cache.InMemoryCacheStore;
import run.halo.app.cache.LevelCacheStore; import run.halo.app.cache.LevelCacheStore;
import run.halo.app.cache.RedisCacheStore; import run.halo.app.cache.RedisCacheStore;
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;
@ -38,9 +35,6 @@ 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);
@ -78,9 +72,4 @@ public class HaloConfiguration {
return stringCacheStore; return stringCacheStore;
} }
@PostConstruct
public void init() {
HaloConst.HALO_VERSION = buildProperties.getVersion();
}
} }

View File

@ -134,13 +134,19 @@ public class HaloConst {
* Database product name. * Database product name.
*/ */
public static String DATABASE_PRODUCT_NAME = null; public static String DATABASE_PRODUCT_NAME = null;
/**
* Version constant. (Available in production environment)
*/
public static final String HALO_VERSION;
/** /**
* user_session * user_session
*/ */
public static String USER_SESSION_KEY = "user_session"; public static String USER_SESSION_KEY = "user_session";
/** static {
* Version constant. // Set version
*/ HALO_VERSION = HaloConst.class.getPackage().getImplementationVersion();
public static String HALO_VERSION = null; }
} }

View File

@ -62,9 +62,4 @@ halo:
auth-enabled: true auth-enabled: true
mode: demo mode: demo
workDir: ${user.home}/halo-demo/ workDir: ${user.home}/halo-demo/
cache: level cache: memory
# use redis as cache to support halo deployment
# cache: redis
# cache-redis-nodes: ['127.0.0.1:6380', '127.0.0.1:6379']
# cache-redis-password: 123456
#

View File

@ -32,6 +32,10 @@ halo:
# Your admin client path is https://your-domain/{admin-path} # Your admin client path is https://your-domain/{admin-path}
admin-path: admin admin-path: admin
# memory or level # memory, level, redis
cache: memory cache: memory
# if cache = redis, you need to set the following options
# cache-redis-nodes: ['127.0.0.1:6380', '127.0.0.1:6379']
# cache-redis-password: 123456

View File

@ -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,10 +48,7 @@ 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}