Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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-admin-api
base: main
commit-message: "chore(docs): auto-update Admin-API swagger"
title: "chore(docs): auto-update Admin-API swagger"
Expand Down
26 changes: 18 additions & 8 deletions src/main/java/com/iemr/admin/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
Expand All @@ -11,14 +13,22 @@

@Configuration
public class SwaggerConfig {

@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI().info(new
Info().title("Admin 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")));

@Bean
public OpenAPI customOpenAPI(Environment env) {
String devUrl = env.getProperty("API_DEV_URL");
String uatUrl = env.getProperty("API_UAT_URL");
String demoUrl = env.getProperty("API_DEMO_URL");
return new OpenAPI()
.info(new Info().title("Admin API").version("version").description("A microservice for the creation and management of beneficiaries."))
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
.addSecurityItem(new SecurityRequirement().addList("my security"))
.components(new Components().addSecuritySchemes("my security",
new SecurityScheme().name("my security").type(SecurityScheme.Type.HTTP).scheme("bearer")))
.servers(java.util.Arrays.asList(
new io.swagger.v3.oas.models.servers.Server().url(devUrl).description("Dev"),
new io.swagger.v3.oas.models.servers.Server().url(uatUrl).description("UAT"),
new io.swagger.v3.oas.models.servers.Server().url(demoUrl).description("Demo")
));
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

}
5 changes: 5 additions & 0 deletions src/main/resources/application-swagger.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ cors.allowed-origins=${CORS_ALLOWED_ORIGINS:http://localhost:9090,http://localho
logging.level.root=INFO

jwt.secret=JWT_SECRET

# Swagger server URLs
API_DEV_URL=https://amritwprdev.piramalswasthya.org
API_UAT_URL=https://uatamrit.piramalswasthya.org
API_DEMO_URL=https://amritdemo.piramalswasthya.org