|
|
|
@ -8,13 +8,19 @@ import io.swagger.v3.oas.models.info.License;
|
|
|
|
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
|
|
|
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
|
|
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
|
import io.swagger.v3.oas.models.servers.Server;
|
|
|
|
import io.swagger.v3.oas.models.servers.Server;
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Configuration
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
public class OpenAPIConfig {
|
|
|
|
public class OpenAPIConfig {
|
|
|
|
|
|
|
|
private final Environment environment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String SECURITY_SCHEME_NAME = "bezkoder-jwt-cookie";
|
|
|
|
private static final String SECURITY_SCHEME_NAME = "bezkoder-jwt-cookie";
|
|
|
|
private static final String PRODUCTION_SERVER_URL = "http://cuuva.com:2480/autoflow";
|
|
|
|
private static final String PRODUCTION_SERVER_URL = "http://cuuva.com:2480/autoflow";
|
|
|
|
@ -55,10 +61,27 @@ public class OpenAPIConfig {
|
|
|
|
.url("http://cuuva.com"));
|
|
|
|
.url("http://cuuva.com"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<Server> createServerList() {
|
|
|
|
public List<Server> createServerList() {
|
|
|
|
return List.of(
|
|
|
|
String[] activeProfiles = environment.getActiveProfiles();
|
|
|
|
new Server().url(PRODUCTION_SERVER_URL).description("Production Server"),
|
|
|
|
|
|
|
|
|
|
|
|
if (activeProfiles.length == 0) {
|
|
|
|
|
|
|
|
// 프로필이 없으면 default
|
|
|
|
|
|
|
|
return List.of(new Server().url(LOCAL_SERVER_URL).description("Default Local Server"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String profile = activeProfiles[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return switch (profile) {
|
|
|
|
|
|
|
|
case "local" -> List.of(
|
|
|
|
new Server().url(LOCAL_SERVER_URL).description("Local Server")
|
|
|
|
new Server().url(LOCAL_SERVER_URL).description("Local Server")
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
case "prod" -> List.of(
|
|
|
|
|
|
|
|
new Server().url(PRODUCTION_SERVER_URL).description("Production Server")
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
default -> List.of(
|
|
|
|
|
|
|
|
new Server().url(LOCAL_SERVER_URL).description("Default Local Server")
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|