Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/swagger-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
with:
token: ${{ secrets.DOCS_REPO_TOKEN }}
path: amrit-docs
branch: auto/swagger-update-${{ github.run_id }}-${{ github.run_attempt }}
branch: auto/swagger-update-scheduler-api
base: main
commit-message: "chore(docs): auto-update Scheduler-API swagger"
title: "chore(docs): auto-update Scheduler-API swagger"
Expand Down
30 changes: 22 additions & 8 deletions src/main/java/com/iemr/tm/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,37 @@

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

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.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import java.util.Arrays;
import io.swagger.v3.oas.models.servers.Server;

@Configuration
public class SwaggerConfig {

@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI().info(new
Info().title("Scheduler API").version("version").description("A microservice for the creation and management of beneficiaries."))
.addSecurityItem(new SecurityRequirement().addList("my security"))
.components(new Components().addSecuritySchemes("my security",
new SecurityScheme().name("my security").type(SecurityScheme.Type.HTTP).scheme("bearer")));
private static final String DEFAULT_SERVER_URL = "http://localhost:9090";
private static final String BEARER_AUTH = "bearerAuth";

@Bean
public OpenAPI customOpenAPI(Environment env) {
String devUrl = env.getProperty("api.dev.url", DEFAULT_SERVER_URL);
String uatUrl = env.getProperty("api.uat.url", DEFAULT_SERVER_URL);
String demoUrl = env.getProperty("api.demo.url", DEFAULT_SERVER_URL);
return new OpenAPI()
.info(new Info().title("Scheduler API").version("1.0.0").description("A microservice for scheduling and appointment management."))
.addSecurityItem(new SecurityRequirement().addList(BEARER_AUTH))
.components(new Components().addSecuritySchemes(BEARER_AUTH,
new SecurityScheme().name(BEARER_AUTH).type(SecurityScheme.Type.HTTP).scheme("bearer")))
.servers(Arrays.asList(
new Server().url(devUrl).description("Dev"),
new Server().url(uatUrl).description("UAT"),
new Server().url(demoUrl).description("Demo")
));
}

}
4 changes: 4 additions & 0 deletions src/main/resources/application-swagger.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Swagger server URLs
api.dev.url=${API_DEV_URL:https://amritwprdev.piramalswasthya.org}
api.uat.url=${API_UAT_URL:https://uatamrit.piramalswasthya.org}
api.demo.url=${API_DEMO_URL:https://amritdemo.piramalswasthya.org}
spring.datasource.url=jdbc:h2:mem:swaggerdb
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ scheduling-slotsize=5
czentrix-server-ip=10.208.122.99
spring.main.allow-bean-definition-overriding=true


Loading