Skip to content

Commit

Permalink
Merge pull request #15 from lab-cherry/develop
Browse files Browse the repository at this point in the history
Release v0.55
  • Loading branch information
taking authored Sep 21, 2023
2 parents e62bd33 + 838b40d commit 1956211
Show file tree
Hide file tree
Showing 36 changed files with 2,630 additions and 41 deletions.
23 changes: 22 additions & 1 deletion application.properties_docker
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ spring.data.mongodb.uri=mongodb://${DATABASE_USERID:-nw}:${DATABASE_USERPASS:-nw
spring.jackson.default-property-inclusion=NON_NULL
# logging.level.ROOT=DEBUG

# Redis connection properties
spring.data.redis.host=${REDIS_HOST:-nw-redis}
spring.data.redis.port=${REDIS_PORT:-8083}

#set your port
server.port=8888
#server.error.include-message=always
Expand All @@ -19,11 +23,28 @@ springdoc.swagger-ui.tags-sorter=alpha
springdoc.swagger-ui.operations-sorter=alpha

# App Properties
#echo 'com-innogrid-medge-project-rndplan-dev-1team-secret-base-by-taking'|base64
lab.cherry.nw.jwtSecret= 29tLWlubm9ncmlkLW1lZGdlLXByb2plY3Qtcm5kcGxhbi1kZXYtMXRlYW0tc2VjcmV0LWJhc2UtYnktdGFrYWluZwo=
lab.cherry.nw.jwtExpirationMs= 86400000

#Email
spring.mail.host=smtp.localhost.com
spring.mail.port=587
spring.mail.properties.debug=true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.ssl.enable= false
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true

spring.mail.username=userName
spring.mail.password=passWord

#echo 'lab-cherry-nw-project-secret-key' | base64
lab.cherry.nw.jwtSecret= bGFiLWNoZXJyeS1udy1wcm9qZWN0LXNlY3JldC1rZXkK
lab.cherry.nw.jwtExpirationMs= 86400000

# MinIo Properties
minio.url=${MINIO_URL:-http://nw-storage:9000}
minio.access-key=${MINIO_ACCESS_KEY:-admin}
minio.secret-key=${MINIO_SECRET_KEY:-nangmanwedding}
minio.secret-key=${MINIO_SECRET_KEY:-nangmanwedding}

3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ subprojects {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
developmentOnly 'org.springframework.boot:spring-boot-devtools:3.0.2'

}

test {
Expand All @@ -68,4 +69,4 @@ subprojects {
bootRun {
String activeProfile = System.properties['spring.profiles.active']
systemProperty "spring.profiles.active", activeProfile
}
}
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ services:
- "8081:8888"
depends_on:
- nw-db
- nw-redis
- nw-storage
# volumes:
# - ./log:/log/spring


nw-db:
image: 'bitnami/mongodb:latest'
container_name: nw-db
Expand All @@ -43,6 +45,19 @@ services:
- './mongodb_data:/bitnami'
- '/etc/localtime:/etc/localtime:ro'


nw-redis:
image: 'redis:latest'
container_name: nw-redis
restart: unless-stopped
entrypoint: redis-server --appendonly yes --maxmemory 4g --maxmemory-policy allkeys-lru
security_opt:
- no-new-privileges:true
volumes:
- './redis_data:/data'
- '/etc/localtime:/etc/localtime:ro'


nw-storage:
image: 'minio/minio:RELEASE.2023-09-04T19-57-37Z'
container_name: nw-storage
Expand Down
10 changes: 9 additions & 1 deletion nw/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ dependencies {
implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'org.springframework:spring-context:6.0.7'
implementation 'org.springframework:spring-context-support:6.0.7'
implementation 'com.sun.mail:jakarta.mail:2.0.1'
implementation 'org.springframework.boot:spring-boot-starter-mail:3.0.2'
implementation 'org.springframework.boot:spring-boot-starter-data-redis:3.0.2'
implementation 'io.lettuce:lettuce-core'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.minio:minio:8.5.5'
implementation 'io.minio:minio-admin:8.5.5'
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package lab.cherry.nw.configuration.email;

import java.util.Properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;


//@ConfigurationProperties(prefix = "mail")
@Configuration
@PropertySource("classpath:application.properties")
public class EmailConfig {
@Value("${spring.mail.username}")
private String id;
@Value("${spring.mail.password}")
private String password;
@Value("${spring.mail.host}")
private String host;
@Value("${spring.mail.port}")
private int port;

@Bean
public JavaMailSender javaMailService() {
JavaMailSenderImpl javaMailSender = new JavaMailSenderImpl();

javaMailSender.setHost(host); // smtp 서버 주소
javaMailSender.setUsername(id); // 설정(발신) 메일 아이디
javaMailSender.setPassword(password); // 설정(발신) 메일 패스워드
javaMailSender.setPort(port); //smtp port
javaMailSender.setJavaMailProperties(getMailProperties()); // 메일 인증서버 정보 가져온다.
javaMailSender.setDefaultEncoding("UTF-8");
return javaMailSender;
}

private Properties getMailProperties() {
Properties properties = new Properties();
properties.setProperty("mail.transport.protocol", "smtp"); // 프로토콜 설정
properties.setProperty("mail.smtp.auth", "true"); // smtp 인증
properties.setProperty("mail.smtp.starttls.enable", "true"); // smtp starttls 사용
properties.setProperty("mail.debug", "true"); // 디버그 사용
// properties.setProperty("mail.smtp.ssl.trust","smtp.mailplug.co.kr"); // ssl 인증 서버 주소
properties.setProperty("mail.smtp.ssl.trust","smtp.naver.com"); // ssl 인증 서버 주소

properties.setProperty("mail.smtp.ssl.enable","false"); // ssl 사용
return properties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import lab.cherry.nw.error.enums.SuccessCode;
import lab.cherry.nw.model.UserEntity;
import lab.cherry.nw.service.AuthService;
import lab.cherry.nw.service.EmailService;
import lab.cherry.nw.util.Security.AccessToken;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -40,6 +41,7 @@ public class AuthController {

private final AuthService authService;


/**
* [AuthController] 회원가입 함수
*
Expand Down Expand Up @@ -120,6 +122,8 @@ public ResponseEntity<?> existUserId(@PathVariable("userid") String userid) {
return new ResponseEntity<>(response, new HttpHeaders(), HttpStatus.OK);
}



@GetMapping("myinfo")
@Operation(summary = "사용자 정보 확인", description = "사용자 정보를 확인합니다.")
public ResponseEntity<?> myInfo() {
Expand All @@ -128,4 +132,5 @@ public ResponseEntity<?> myInfo() {
// final ResultResponse response = ResultResponse.of(SuccessCode.OK);
return new ResponseEntity<>(authService.myInfo(), new HttpHeaders(), HttpStatus.OK);
}
}

}
Loading

0 comments on commit 1956211

Please sign in to comment.