Skip to content

Commit

Permalink
#17 feat: health check를 위한 WebRestController 생성 및 actuator 라이브러리 의존성 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dangnak2 committed Jul 16, 2023
1 parent 4cec86b commit f5140cb
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 5 deletions.
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ repositories {
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
runtimeOnly 'com.mysql:mysql-connector-j'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

// jpa
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// jasypt
implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3'

// chat gpt
implementation 'com.theokanning.openai-gpt3-java:service:0.12.0'
// actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.example.cherrypickserver.global.presentation;

import lombok.RequiredArgsConstructor;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

@RestController
@RequiredArgsConstructor
public class WebRestController {

private final Environment environment;

@GetMapping("/profile")
public String getProfile() {
return Arrays.stream(environment.getActiveProfiles()).findFirst().orElse("");
}

}
38 changes: 37 additions & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
spring:
config:
activate:
on-profile: set1
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ENC(l99MJqAUPwKvze+lJpIq8F9T+dfHg9TTE0qKgyM2jk5o0hMR6RB1SNRkdOdqBqqR0Gw0xUgjTKCo5ShUQm6TQJvnqO+NbjP2hGlXwGGgnPo0lZZKQO5Hm0O08AiU8/VYC8Vmb7xdx7ZIKfYSGgpdcHX/ifN5dceHEOLUjuxinRdQVap8gtUiHqbLDCoLIKXz8xLOOlyQnvg=)
Expand All @@ -20,4 +23,37 @@ jasypt:
bean : jasyptStringEncryptor

gpt:
key: ENC(Jzyf0nsLehjSuR1auVWcle/+yw4FYRSatil6ylkRnvh73RJM03nNp6ECWy+VWDTo4xABNNlrhIJpsnpiiGkilQ==)
key: ENC(Jzyf0nsLehjSuR1auVWcle/+yw4FYRSatil6ylkRnvh73RJM03nNp6ECWy+VWDTo4xABNNlrhIJpsnpiiGkilQ==)

server:
port: 8081
---

spring:
config:
activate:
on-profile: set2
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ENC(l99MJqAUPwKvze+lJpIq8F9T+dfHg9TTE0qKgyM2jk5o0hMR6RB1SNRkdOdqBqqR0Gw0xUgjTKCo5ShUQm6TQJvnqO+NbjP2hGlXwGGgnPo0lZZKQO5Hm0O08AiU8/VYC8Vmb7xdx7ZIKfYSGgpdcHX/ifN5dceHEOLUjuxinRdQVap8gtUiHqbLDCoLIKXz8xLOOlyQnvg=)
username: ENC(fYM/g4oPrAc9UX8Ei9BGbEaFpbjXtvU2)
password: ENC(xA+qzw+zb/hMNOSQdVbT4/dOiGmPZkrR)

jpa:
database: mysql
hibernate:
ddl-auto: update
generate-ddl: true
show-sql: true
properties:
hibernate:
format_sql: true

jasypt:
encryptor:
bean : jasyptStringEncryptor

gpt:
key: ENC(Jzyf0nsLehjSuR1auVWcle/+yw4FYRSatil6ylkRnvh73RJM03nNp6ECWy+VWDTo4xABNNlrhIJpsnpiiGkilQ==)
server:
port: 8082

0 comments on commit f5140cb

Please sign in to comment.