bootstrap.yml
생성
// bootstrap.yml
encrypt:
key: abcdefghijklmnopqrstuvwxyz0123456789 # 암호화 키
// appication.yml
// spring.datasource.* 부분을 주석 혹은 삭제
spring:
application:
name: user-service
rabbitmq:
host: 127.0.0.1
port: 5672
username: guest
password: guest
h2:
console:
enabled: true
settings:
web-allow-others: true
path: /h2-console
# datasource:
# driver-class-name: org.h2.Driver
# url: jdbc:h2:mem:testdb
# username: sa
# password: sa
// bootstrap.yml
// configservice에서 지정한 경로의 user-service.yml파일과 연결
spring:
cloud:
config:
uri: http://127.0.0.1:8888
name: user-service
// user-service.yml
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:testdb
username: sa
password: sa
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:testdb
username: sa
password: '{cipher}4ecf1d3fa008a040187238acf43539ef05914db55dd8c0bc76391f10747fa60b'
keytool -genkeypair -alias apiEncryptionKey -keyalg RSA -dname "CN=사용자 이름, OU=API Development, O=joneconsulting.co.kr, L=Seoul, C=KR" -keypass "비밀번호" -keystore apiEncryptionKey.jks -storepass "비밀번호"
입력keytool -list -keystore apiEncryptionKey.jks -v
입력keytool -export -alias apiEncryptionKey -keystore apiEncryptionKey.jks -rfc -file trustServer.cer
입력keytool -import -alias trustServer -file trustServer.cer -keystore publicKey.jks
을 입력해 생성할 수 있다.apiEncryptionKey.jks
는 PrivateKeypublicKey.jks
는 PublicKey// bootstrap.yml
encrypt:
# key: abcdefghijklmnopqrstuvwxyz0123456789
key-store:
location: file:///${user.home}/IdeaProjects/work/keystore/apiEncryptionKey.jks
password: test1234
alias: apiEncryptionKey
이제 직접 설정한 key대신 keytool로 생성된 키를 이용해 key를 지정할 수 있다.