Add doc tip when starting up

pull/137/head
johnniang 2019-03-08 18:51:59 +08:00
parent faa616d992
commit ca78680b3a
2 changed files with 20 additions and 4 deletions

View File

@ -1,11 +1,14 @@
package cc.ryanc.halo;
import cc.ryanc.halo.config.properties.HaloProperties;
import cc.ryanc.halo.logging.Logger;
import cc.ryanc.halo.repository.base.BaseRepositoryImpl;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableScheduling;
@ -29,10 +32,20 @@ public class Application {
public static void main(String[] args) {
// Run application
ApplicationContext context = SpringApplication.run(Application.class, args);
// Get server port
String serverPort = context.getEnvironment().getProperty("server.port");
SpringApplication.run(Application.class, args);
}
LOG.debug("Halo started at http://localhost:" + serverPort);
@Bean
CommandLineRunner runner(ApplicationContext context, HaloProperties haloProperties) {
return args -> {
// Get server port
String serverPort = context.getEnvironment().getProperty("server.port");
LOG.debug("Halo started at {}:{}", "http://localhost", serverPort);
if (!haloProperties.getDocDisabled()) {
LOG.debug("Halo doc enable at {}:{}/{}", "http://localhost", serverPort, "swagger-ui.html");
}
};
}
}

View File

@ -58,11 +58,14 @@ spring:
# 多语言资源文件路径
messages:
basename: i18n/messages
cache:
type: none
logging:
level:
cc.ryanc.halo: DEBUG
org.hibernate: ERROR
file: ./logs/log.log
halo:
doc-disabled: false