yaml 파일 local/prod 분리

design
시온파파 3 years ago
parent 94bf424b8f
commit 59d36ce485

@ -1,14 +1,21 @@
package cokr.xit.ci; package cokr.xit.ci;
import jdk.internal.module.Checks;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.ApplicationPidFileWriter; import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import java.util.Optional;
@Slf4j @Slf4j
@ComponentScan(basePackages = "cokr.xit") @ComponentScan(basePackages = "cokr.xit")
@SpringBootApplication @SpringBootApplication
@ServletComponentScan
public class AppCiApplication { public class AppCiApplication {
public static void main(String[] args) { public static void main(String[] args) {
@ -16,21 +23,28 @@ public class AppCiApplication {
Long begin = System.currentTimeMillis(); Long begin = System.currentTimeMillis();
log.info("CI Application load start..."); log.info("CI Application load start...");
if(!Optional.ofNullable(System.getProperty("spring.profiles.active")).isPresent()) {
log.error("====================================================================");
log.error(">>>>>>>>>>>>>> Undefined start option <<<<<<<<<<<<<<");
log.error(">>>>>>>>>>>>>> -Dspring.profiles.active=local|prod <<<<<<<<<<<<<<");
log.error("============== ENS Application start fail ===============");
log.error("====================================================================");
System.exit(-1);
}
SpringApplication application = new SpringApplication(AppCiApplication.class); SpringApplication application = new SpringApplication(AppCiApplication.class);
application.addListeners(new ApplicationPidFileWriter()); //PID(Process ID 작성) application.addListeners(new ApplicationPidFileWriter()); //PID(Process ID 작성)
application.run(args); application.run(args);
log.info("========================================================================================="); log.info("============================================================================");
log.info("========== CI Application load Complete :: active profiles - {} ==========", System.getProperty("spring.profiles.active")); log.info("========== CI Application load Complete :: active profiles - {} ==========", System.getProperty("spring.profiles.active"));
log.info("========================================================================================="); log.info("============================================================================");
Long end = System.currentTimeMillis(); Long end = System.currentTimeMillis();
System.out.println("===================================================="); System.out.println("====================================================");
System.out.println("기동 소요시간: "+ (end-begin) +"ms"); System.out.println("기동 소요시간: "+ (end-begin) +"ms");
System.out.println("===================================================="); System.out.println("====================================================");
} }
} }

@ -22,9 +22,9 @@ public class NiceCiController {
private final NiceCiService diCiService; private final NiceCiService diCiService;
@Value("${nice.api.ci.site-code}") @Value("${nice.api.ci.site-code ?: }")
private String SITE_CODE; private String SITE_CODE;
@Value("${nice.api.ci.site-pw}") @Value("${nice.api.ci.site-pw ?: }")
private String SITE_PW; private String SITE_PW;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")

@ -0,0 +1,24 @@
# =====================================================
# Server 설정
# =====================================================
server:
port: 8080
# =====================================================
# Spring 설정
# =====================================================
spring:
config:
activate:
on-profile: local
# =====================================================
# NICE api 계약정보
# =====================================================
nice:
api:
ci:
site-code:
site-pw:

@ -0,0 +1,24 @@
# =====================================================
# Server 설정
# =====================================================
server:
port: 8080
# =====================================================
# Spring 설정
# =====================================================
spring:
config:
activate:
on-profile: prod
# =====================================================
# NICE api 계약정보
# =====================================================
nice:
api:
ci:
site-code:
site-pw:

@ -1,7 +1,9 @@
# =====================================================
# Spring 설정
# =====================================================
spring: spring:
profiles: profiles:
active: prod active: local
mvc: mvc:
view: view:
prefix: /WEB-INF/jsp/ prefix: /WEB-INF/jsp/
@ -11,7 +13,7 @@ spring:
enabled: true enabled: true
pid: pid:
file: app-ci.pid file: app-ci.pid
# ===================================================== # =====================================================
# Logging 설정 # Logging 설정
# ===================================================== # =====================================================
@ -28,12 +30,3 @@ logging:
root: info root: info
'[org.hibernate.sql]': info '[org.hibernate.sql]': info
# =====================================================
# NICE api 계약정보
# =====================================================
nice:
api:
ci:
site-code:
site-pw:

Loading…
Cancel
Save