Skip to content

Commit

Permalink
[Refactor] Config divide (#148)
Browse files Browse the repository at this point in the history
* test: 테스트 리팩토링

* setting: 환경변수 파일을 환경별로 분리

test, prod, dev로 구분

* feat(start.sh): 시작 스크립트 파일에 환경파일 언급 추가와 heap메모리 제한 추가
  • Loading branch information
zbqmgldjfh committed Mar 5, 2024
1 parent 09afebf commit 37445b4
Show file tree
Hide file tree
Showing 23 changed files with 579 additions and 520 deletions.
4 changes: 2 additions & 2 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cp $PROJECT_ROOT/build/libs/*.jar $JAR_FILE
# jar 파일 실행
chmod 755 $JAR_FILE
echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG
nohup java -jar $JAR_FILE > $APP_LOG 2> $ERROR_LOG &
nohup java -jar -Dspring.profiles.active=prod -Xmx128 -Xmx128m $JAR_FILE > $APP_LOG 2> $ERROR_LOG &

CURRENT_PID=$(pgrep -f $JAR_FILE)
echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG
echo "$TIME_NOW > 실행된 프로세스 아이디 $CURRENT_PID 입니다." >> $DEPLOY_LOG
9 changes: 0 additions & 9 deletions src/main/java/com/kustacks/kuring/config/CustomConfig.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class KuisNoticeApiClient implements NoticeApiClient<CommonNoticeFormatDt
@Override
@Retryable(value = {InternalLogicException.class})
public List<CommonNoticeFormatDto> request(KuisNoticeInfo kuisNoticeRequestBody) throws InternalLogicException {

// sessionId 획득
String sessionId = parsingKuisAuthManager.getSessionId();

Expand All @@ -64,9 +63,14 @@ private HttpEntity<String> kuisNoticeRequests(KuisNoticeInfo kuisNoticeRequestBo
return new HttpEntity<>(encodedNoticeRequestBody, noticeRequestHeader);
}

private ResponseEntity<KuisNoticeResponseDto> sendKuisNoticesRequestAndResponse(HttpEntity<String> noticeRequestEntity) {
private ResponseEntity<KuisNoticeResponseDto> sendKuisNoticesRequestAndResponse(
HttpEntity<String> noticeRequestEntity
) throws InternalLogicException {
try {
return restTemplate.postForEntity(kuisNoticeProperties.getRequestUrl(), noticeRequestEntity, KuisNoticeResponseDto.class);
return restTemplate.postForEntity(
kuisNoticeProperties.getRequestUrl(),
noticeRequestEntity,
KuisNoticeResponseDto.class);
} catch (RestClientException e) {
log.warn("세션 갱신이 필요합니다.");
parsingKuisAuthManager.forceRenewing();
Expand Down
110 changes: 110 additions & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
server:
deploy:
environment: ${DEPLOY_ENV}
port: ${PORT:8080}
tomcat:
mbeanregistry:
enabled: true

spring:
jpa:
generate-ddl: false
hibernate:
ddl-auto: none
properties:
hibernate:
jdbc:
batch_size: 100
format_sql: true
dialect: com.kustacks.kuring.config.CustomMariaDbDialect
defer-datasource-initialization: false
show-sql: false
open-in-view: false
datasource:
hikari:
connectionTimeout: '30000'
maximum-pool-size: '8'
max-lifetime: '1800000'
password: ${DB_PASSWORD}
username: ${DB_USER}
url: jdbc:${DB_URL}
driver-class-name: org.mariadb.jdbc.Driver
flyway:
enabled: true
baseline-on-migrate: true
url: jdbc:${DB_URL}
user: ${DB_USER}
password: ${DB_PASSWORD}
thymeleaf:
cache: true
prefix: classpath:/templates/
suffix: .html
enabled: true
jackson:
serialization:
FAIL_ON_EMPTY_BEANS: false

logging:
level:
org:
apache:
coyote:
http11: info
file:
name: classpath:/kuring.log

management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"

security:
jwt:
token:
secret-key: ${JWT_SECRET_KEY}
expire-length: ${JWT_EXPIRE_LENGTH}


notice:
kuis:
request-url: https://kuis.konkuk.ac.kr/CmmnOneStop/find.do
referer-url: https://kuis.konkuk.ac.kr/index.do
real-estate:
list-url: http://www.realestate.ac.kr/gb/bbs/board.php?bo_table=notice
view-url: http://www.realestate.ac.kr/gb/bbs/board.php?bo_table=notice
recent:
list-url: https://{department}.konkuk.ac.kr/bbs/{department}/{siteId}/artclList.do
view-url: https://{department}.konkuk.ac.kr/bbs/{department}/{siteId}/{noticeId}/artclView.do
normal-base-url: https://old.konkuk.ac.kr/do/MessageBoard/ArticleRead.do
library:
request-url: https://library.konkuk.ac.kr/pyxis-api/1/bulletin-boards/1/bulletins
library-base-url: https://library.konkuk.ac.kr/library-guide/bulletins/notice

auth:
api-skeleton-producer-url: https://kuis.konkuk.ac.kr/ui/cpr-lib/user-modules.js?p=0.9460032500983822
password: ${KU_PASSWORD}
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38
id: ${KU_ID}
session: JSESSIONID=00015GJS2T_gl7M-TqGjYvyHAuJ:-103KQM
referer: https://kuis.konkuk.ac.kr/index.do
login-url: https://kuis.konkuk.ac.kr/Login/login.do

firebase:
file-path: third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json

admin:
password: ${ADMIN_PASSWORD}
id: ${ADMIN_ID}

ip:
proxy-list: 14.63.228.239:80, 101.79.15.198:80, 222.104.128.205:8678, 106.244.154.91:8080, 103.51.205.42:8181

staff:
real-estate-url: http://www.realestate.ac.kr/gb/bbs/board.php?bo_table=faculty
communication-design-url: http://www.konkuk.ac.kr/jsp/Coll/coll_01_13_01_01_tab01.jsp
living-design-url: http://www.konkuk.ac.kr/jsp/Coll/coll_01_13_01_05_tab01.jsp
each-dept-url: http://home.konkuk.ac.kr/cms/Common/Professor/ProfessorList.do
110 changes: 110 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
server:
deploy:
environment: ${DEPLOY_ENV}
port: ${PORT:8080}
tomcat:
mbeanregistry:
enabled: true

spring:
jpa:
generate-ddl: false
hibernate:
ddl-auto: none
properties:
hibernate:
jdbc:
batch_size: 100
format_sql: true
dialect: com.kustacks.kuring.config.CustomMariaDbDialect
defer-datasource-initialization: false
show-sql: false
open-in-view: false
datasource:
hikari:
connectionTimeout: '30000'
maximum-pool-size: '8'
max-lifetime: '1800000'
password: ${DB_PASSWORD}
username: ${DB_USER}
url: jdbc:${DB_URL}
driver-class-name: org.mariadb.jdbc.Driver
flyway:
enabled: true
baseline-on-migrate: true
url: jdbc:${DB_URL}
user: ${DB_USER}
password: ${DB_PASSWORD}
thymeleaf:
cache: true
prefix: classpath:/templates/
suffix: .html
enabled: true
jackson:
serialization:
FAIL_ON_EMPTY_BEANS: false

logging:
level:
org:
apache:
coyote:
http11: info
file:
name: classpath:/kuring.log

management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"

security:
jwt:
token:
secret-key: ${JWT_SECRET_KEY}
expire-length: ${JWT_EXPIRE_LENGTH}


notice:
kuis:
request-url: https://kuis.konkuk.ac.kr/CmmnOneStop/find.do
referer-url: https://kuis.konkuk.ac.kr/index.do
real-estate:
list-url: http://www.realestate.ac.kr/gb/bbs/board.php?bo_table=notice
view-url: http://www.realestate.ac.kr/gb/bbs/board.php?bo_table=notice
recent:
list-url: https://{department}.konkuk.ac.kr/bbs/{department}/{siteId}/artclList.do
view-url: https://{department}.konkuk.ac.kr/bbs/{department}/{siteId}/{noticeId}/artclView.do
normal-base-url: https://old.konkuk.ac.kr/do/MessageBoard/ArticleRead.do
library:
request-url: https://library.konkuk.ac.kr/pyxis-api/1/bulletin-boards/1/bulletins
library-base-url: https://library.konkuk.ac.kr/library-guide/bulletins/notice

auth:
api-skeleton-producer-url: https://kuis.konkuk.ac.kr/ui/cpr-lib/user-modules.js?p=0.9460032500983822
password: ${KU_PASSWORD}
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38
id: ${KU_ID}
session: JSESSIONID=00015GJS2T_gl7M-TqGjYvyHAuJ:-103KQM
referer: https://kuis.konkuk.ac.kr/index.do
login-url: https://kuis.konkuk.ac.kr/Login/login.do

firebase:
file-path: third/ku-stack-firebase-adminsdk-87nwq-5ba04dfc12.json

admin:
password: ${ADMIN_PASSWORD}
id: ${ADMIN_ID}

ip:
proxy-list: 14.63.228.239:80, 101.79.15.198:80, 222.104.128.205:8678, 106.244.154.91:8080, 103.51.205.42:8181

staff:
real-estate-url: http://www.realestate.ac.kr/gb/bbs/board.php?bo_table=faculty
communication-design-url: http://www.konkuk.ac.kr/jsp/Coll/coll_01_13_01_01_tab01.jsp
living-design-url: http://www.konkuk.ac.kr/jsp/Coll/coll_01_13_01_05_tab01.jsp
each-dept-url: http://home.konkuk.ac.kr/cms/Common/Professor/ProfessorList.do
68 changes: 2 additions & 66 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,3 @@
server:
port: ${PORT:8080}
tomcat:
mbeanregistry:
enabled: true

spring:
jpa:
generate-ddl: false
hibernate:
ddl-auto: none
properties:
hibernate:
jdbc:
batch_size: 100
format_sql: true
dialect: com.kustacks.kuring.config.CustomMariaDbDialect
defer-datasource-initialization: false
show-sql: false
open-in-view: false
datasource:
hikari:
connectionTimeout: '30000'
maximum-pool-size: '8'
max-lifetime: '1800000'
password: ${DB_PASSWORD}
username: ${DB_USER}
url: jdbc:${DB_URL}
driver-class-name: org.mariadb.jdbc.Driver
flyway:
enabled: true
baseline-on-migrate: true
url: jdbc:${DB_URL}
user: ${DB_USER}
password: ${DB_PASSWORD}
thymeleaf:
cache: true
prefix: classpath:/templates/
suffix: .html
enabled: true
jackson:
serialization:
FAIL_ON_EMPTY_BEANS: false

logging:
level:
org:
apache:
coyote:
http11: info
file:
name: classpath:/kuring.log

management:
endpoint:
health:
show-details: always
endpoints:
web:
exposure:
include: "*"

security:
jwt:
token:
secret-key: ${JWT_SECRET_KEY}
expire-length: ${JWT_EXPIRE_LENGTH}
profiles:
active: dev
31 changes: 0 additions & 31 deletions src/main/resources/constants.properties

This file was deleted.

21 changes: 0 additions & 21 deletions src/test/java/com/kustacks/kuring/ApiDocumentUtils.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.groups.Tuple.tuple;

@DisplayName("리포지토리 : Notice")
class NoticeRepositoryTest extends IntegrationTestSupport {

@Autowired
Expand Down
Loading

0 comments on commit 37445b4

Please sign in to comment.