Adding profiles for different OpenAPI server URLS in different environments #21

Merged
hitanshu merged 3 commits from hitanshu/CFTunnels:profiles into test 2025-06-04 05:37:10 +00:00
5 changed files with 9 additions and 1 deletions
Showing only changes of commit c5d01ece01 - Show all commits

View File

@ -2,6 +2,7 @@ package com.hithomelabs.CFTunnels.Config;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -10,9 +11,12 @@ import java.util.ArrayList;
@Configuration @Configuration
public class OpenApiConfig { public class OpenApiConfig {
@Value("${api.baseUrl}")
private String baseUrl;
@Bean @Bean
public OpenAPI openAPI(){ public OpenAPI openAPI(){
Server httpsServer = new Server().url("https://testcf.hithomelabs.com"); Server httpsServer = new Server().url(baseUrl);
OpenAPI openApi = new OpenAPI(); OpenAPI openApi = new OpenAPI();
ArrayList<Server> servers = new ArrayList<>(); ArrayList<Server> servers = new ArrayList<>();
servers.add(httpsServer); servers.add(httpsServer);

View File

@ -0,0 +1 @@
api.baseUrl=http://localhost:8080

View File

@ -0,0 +1 @@
api.baseUrl=https://cftunnels.hithomelabs.com

View File

@ -0,0 +1 @@
api.baseUrl=https://testcf.hithomelabs.com

View File

@ -2,3 +2,4 @@ spring.application.name=CFTunnels
cloudflare.accountId=${CLOUDFLARE_ACCOUNT_ID} cloudflare.accountId=${CLOUDFLARE_ACCOUNT_ID}
cloudflare.apiKey=${CLOUDFLARE_API_KEY} cloudflare.apiKey=${CLOUDFLARE_API_KEY}
cloudflare.email=${CLOUDFLARE_EMAIL} cloudflare.email=${CLOUDFLARE_EMAIL}
spring.profiles.active=${ENV}