From 3b75ea18c0afede7d355499a74410f9fdc85d32b Mon Sep 17 00:00:00 2001 From: kimyonghwa Date: Tue, 30 Apr 2019 16:22:41 +0900 Subject: [PATCH] seperate environment profile --- README.md | 26 +++++++++++++++++++++++- src/main/resources/application-alpha.yml | 16 +++++++++++++++ src/main/resources/application-local.yml | 18 ++++++++++++++++ src/main/resources/application.yml | 19 ++++------------- 4 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 src/main/resources/application-alpha.yml create mode 100644 src/main/resources/application-local.yml diff --git a/README.md b/README.md index 951fa87..3eec55b 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,32 @@ - Run -> SpringBootApiApplication - Swagger - http://localhost:8080/swagger-ui.html + +### 3. DDL +create table user ( + msrl bigint not null auto_increment, + name varchar(100) not null, + password varchar(100), + provider varchar(100), + uid varchar(50) not null, + primary key (msrl) + ) engine=InnoDB; + +create table user_roles ( + user_msrl bigint not null, + roles varchar(255) + ) engine=InnoDB; + + +alter table user +add constraint UK_a7hlm8sj8kmijx6ucp7wfyt31 unique (uid); -### 3. 목차 +alter table user_roles + add constraint FKel3d4qj41g0sy1mtp4sh055g7 + foreign key (user_msrl) + references user (msrl); + +### 4. 목차 - SpringBoot2로 Rest api 만들기(1) – Intellij Community에서 프로젝트생성 - Document - https://daddyprogrammer.org/post/19/spring-boot1-start-intellij/ diff --git a/src/main/resources/application-alpha.yml b/src/main/resources/application-alpha.yml new file mode 100644 index 0000000..d2c93d4 --- /dev/null +++ b/src/main/resources/application-alpha.yml @@ -0,0 +1,16 @@ +spring: + profiles: alpha + datasource: + url: jdbc:mysql://127.0.0.1:33060/daddyprogrammer?useUnicode=true&autoReconnect=true&characterEncoding=utf8&allowMultiQueries=true&useSSL=false + driver-class-name: com.mysql.cj.jdbc.Driver + username: happydaddy + password: daddy!@#1004 + jpa: + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + properties.hibernate: + hbm2ddl.auto: none + format_sql: true + showSql: true + generate-ddl: false + url: + base: http://alpha.daddyprogrammer.org diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml new file mode 100644 index 0000000..50f941e --- /dev/null +++ b/src/main/resources/application-local.yml @@ -0,0 +1,18 @@ +server: + port: 8080 + +spring: + profiles: local + datasource: + url: jdbc:h2:tcp://localhost/~/test + driver-class-name: org.h2.Driver + username: sa + jpa: + database-platform: org.hibernate.dialect.H2Dialect + properties.hibernate: + hbm2ddl.auto: update + format_sql: true + showSql: true + generate-ddl: true + url: + base: http://localhost:8080 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 84d4c43..c0e050f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,20 +1,9 @@ -server: - port: 8080 - spring: - datasource: - url: jdbc:h2:tcp://localhost/~/test - driver-class-name: org.h2.Driver - username: sa - jpa: - database-platform: org.hibernate.dialect.H2Dialect - properties.hibernate.hbm2ddl.auto: update - showSql: true + profiles: + active: local # 디폴트 환경 messages: basename: i18n/exception encoding: UTF-8 - jwt: - secret: govlepel@$& social: kakao: client_id: XXXXXXXXXXXXXXXXXXXXXXXXXX # 앱생성시 받은 REST API 키 @@ -23,5 +12,5 @@ spring: login: https://kauth.kakao.com/oauth/authorize token: https://kauth.kakao.com/oauth/token profile: https://kapi.kakao.com/v2/user/me - url: - base: http://localhost:8080 + jwt: + secret: govlepel@$&