Skip to content

Commit 5cbef5c

Browse files
committed
Infra: 개발/운영/테스트 환경 분리
- application.yml -> 현재 환경 정보 - application-dev.yml -> 개발 환경 정보 - application-prod.yml -> 운영 환경 정보 - application-test.yml -> 테스트 환경 정보 - .env.default 파일 추가
1 parent e3ffd12 commit 5cbef5c

File tree

7 files changed

+50
-29
lines changed

7 files changed

+50
-29
lines changed

.env.default

Whitespace-only changes.

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies {
3838
testImplementation("org.springframework.boot:spring-boot-starter-test")
3939
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
4040
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.13")
41+
implementation ("io.github.cdimascio:dotenv-java:3.0.0")
4142
}
4243

4344
tasks.withType<Test> {

src/main/java/com/back/Application.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ public static void main(String[] args) {
1212
SpringApplication.run(Application.class, args);
1313
}
1414

15-
}
15+
}

src/main/java/com/back/global/config/SpringDocConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class SpringDocConfig {
1414
@Bean
1515
public GroupedOpenApi groupApiV1() {
1616
return GroupedOpenApi.builder()
17-
.group("apiV1")
18-
.pathsToMatch("/api/v1/**")
17+
.group("api")
18+
.pathsToMatch("/api/**")
1919
.build();
2020
}
2121
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
spring:
2+
datasource:
3+
url: jdbc:h2:./db_dev;MODE=MySQL
4+
driver-class-name: org.h2.Driver
5+
username: sa
6+
password:
7+
8+
config:
9+
import: optional:file:.env[.properties]
10+
11+
jpa:
12+
database-platform: org.hibernate.dialect.H2Dialect
13+
hibernate:
14+
ddl-auto: update # [none | validate | update | create | create-drop]
15+
show-sql: true
16+
properties:
17+
hibernate:
18+
format_sql: true
19+
highlight_sql: true
20+
use_sql_comments: true
21+
22+
springdoc:
23+
default-produces-media-type: application/json;charset=UTF-8
24+
25+
logging:
26+
level:
27+
org.hibernate.orm.jdbc.bind: trace
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
spring:
2+
jpa:
3+
database-platform: org.hibernate.dialect.MySQLDialect
4+
hibernate:
5+
ddl-auto: validate # [none | validate | update | create | create-drop]
6+
7+
config:
8+
import: optional:file:.env[.properties]
9+
10+
datasource:
11+
url: jdbc:mysql://${MYSQL_HOST}:3306/${MYSQL_DATABASE}?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
12+
driver-class-name: com.mysql.cj.jdbc.Driver
13+
username: ${MYSQL_USERNAME}
14+
password: ${MYSQL_PASSWORD}
15+
16+
springdoc:
17+
default-produces-media-type: application/json;charset=UTF-8

src/main/resources/application.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,5 @@ spring:
22
application:
33
name: catfe-backend
44

5-
datasource:
6-
url: jdbc:h2:./db_dev;MODE=MySQL
7-
driver-class-name: org.h2.Driver
8-
username: sa
9-
password:
10-
11-
config:
12-
import: optional:file:.env
13-
14-
jpa:
15-
database-platform: org.hibernate.dialect.H2Dialect
16-
hibernate:
17-
ddl-auto: update # [none | validate | update | create | create-drop]
18-
show-sql: true
19-
properties:
20-
hibernate:
21-
format_sql: true
22-
highlight_sql: true
23-
use_sql_comments: true
24-
25-
springdoc:
26-
default-produces-media-type: application/json;charset=UTF-8
27-
28-
logging:
29-
level:
30-
org.hibernate.orm.jdbc.bind: trace
5+
profiles:
6+
active: dev

0 commit comments

Comments
 (0)