Skip to content

Commit

Permalink
Test: swagger / url만으로 해결되는지
Browse files Browse the repository at this point in the history
  • Loading branch information
BYEONGRYEOL committed Jun 4, 2024
1 parent becd560 commit 486951d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
image: byeongryeol/genti-dev:latest
container_name: genti-dev
volumes:
- ./home/ubuntu/workspace/logs:/logs # 로그 경로 마운트
- /home/ubuntu/workspace/logs:/logs # 로그 경로 마운트
ports:
- ${SERVER_BINDING_PORT}:${SERVER_CONTAINER_PORT}
redis:
Expand Down
31 changes: 27 additions & 4 deletions src/main/java/com/gt/genti/other/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.gt.genti.other.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.servers.Server;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.security.SecurityRequirement;
Expand All @@ -15,17 +17,38 @@
title = "GenTi API",
description = "1. 인증 관련 우측에 Authorize 버튼누르고 value에 발급받은 테스트용 토큰 앞에 prefix 'Bearer '를 빼고 입력해주시면 됩니다.",
version = "v1"
)
),
servers = {@Server(url = "/", description = "Default Server URL")}
)
@Configuration
public class SwaggerConfig {

private static final String BEARER_TOKEN_PREFIX = "Bearer"; // Bearer직접 넣어서 주는걸로 결정
private final String BEARER_TOKEN_PREFIX = "Bearer"; // Bearer직접 넣어서 주는걸로 결정
private final String securityJwtName = "JWT";

// private final String deployUrl;
// private final String localUrl;

// public SwaggerConfig(
// @Value("${springdoc.url.deploy}") final String deployUrl,
// @Value("${springdoc.url.local}") final String localUrl
// ) {
// this.deployUrl = deployUrl;
// this.localUrl = localUrl;
// }

@Bean
public OpenAPI openAPI() {
String securityJwtName = "JWT";
SecurityRequirement securityRequirement = new SecurityRequirement().addList(securityJwtName);
// final io.swagger.v3.oas.models.servers.Server deployServer = new io.swagger.v3.oas.models.servers.Server();
// deployServer.setUrl(deployUrl);
// deployServer.description("운영 환경 서버 url");
//
// final io.swagger.v3.oas.models.servers.Server localServer = new io.swagger.v3.oas.models.servers.Server();
// localServer.setUrl(localUrl);
// localServer.description("로컬(BE용) 환경 서버 url");


final SecurityRequirement securityRequirement = new SecurityRequirement().addList(securityJwtName);
Components components = new Components()
.addSecuritySchemes(securityJwtName, new SecurityScheme()
.name(securityJwtName)
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ springdoc:
model-and-view-allowed: true
paths-to-match:
- /api/**
url:
deploy: https://genti.kr
local: http://127.0.0.1


0 comments on commit 486951d

Please sign in to comment.