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
7 changed files with 14 additions and 2 deletions

View File

@ -17,4 +17,4 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Gradle build
run: ./gradlew build --debug
run: ./gradlew build --info

View File

@ -13,6 +13,10 @@ java {
}
}
test {
systemProperty 'spring.profiles.active', 'test'
}
repositories {
mavenCentral()
}

View File

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