Skip to content

Commit

Permalink
fix swagger url
Browse files Browse the repository at this point in the history
  • Loading branch information
dojinyou committed Mar 3, 2024
1 parent 1ed68a6 commit 65a1b14
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
S3_ACCESS_KEY=${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY=${{ secrets.S3_SECRET_KEY }}
S3_BUCKET=${{ secrets.S3_BUCKET }}
API_URL=${{ secrets.API_URL }}
tags: |
eatda/api-server:latest
Expand Down Expand Up @@ -73,7 +74,7 @@ jobs:
sudo docker rm - f $(docker ps -qa)
sudo docker pull eatda/api-server:latest
sudo docker stop $(sudo docker ps -aq)
sudo docker run -p 8080:8080 -d eatda/api-server:latest --name api-server
sudo docker run -p 80:8080 -d eatda/api-server:latest --name api-server
- name: Remove IP FROM security group
run: |
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG DB_PASSWORD
ARG S3_ACCESS_KEY
ARG S3_SECRET_KEY
ARG S3_BUCKET
ARG API_URL

COPY ${JAR_FILE} app.jar

Expand All @@ -21,5 +22,6 @@ ENV DB_PASSWORD=${DB_PASSWORD}
ENV S3_ACCESS_KEY=${S3_ACCESS_KEY}
ENV S3_SECRET_KEY=${S3_SECRET_KEY}
ENV S3_BUCKET=${S3_BUCKET}
ENV API_URL=${API_URL}

ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=${PROFILE}", "-Djava.security.egd=file:/dev/./urandom", "/app.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ package com.mjucow.eatda.common.config
import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.OpenAPI
import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.servers.Server
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
class SwaggerConfig {
class SwaggerConfig(
@Value("\${swagger.api-url}")
val apiUrl: String,
) {
@Bean
fun swaggerApi(): OpenAPI = OpenAPI()
.components(Components())
.servers(listOf(Server().apply { url = apiUrl }))
.info(
Info()
.title("Eatda API Documentation")
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ springdoc:
groups:
enabled: true

swagger:
api-url: http://localhost:8080

---

spring:
Expand Down Expand Up @@ -107,3 +110,6 @@ aws:
access-key: ${S3_ACCESS_KEY}
secret-key: ${S3_SECRET_KEY}
bucket: ${S3_BUCKET}

swagger:
api-url: ${API_URL}

0 comments on commit 65a1b14

Please sign in to comment.