Adding profiles for different OpenAPI server URLS in different environments #21
@ -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);
|
||||
|
||||
1
src/main/resources/application-local.properties
Normal file
1
src/main/resources/application-local.properties
Normal file
@ -0,0 +1 @@
|
||||
api.baseUrl=http://localhost:8080
|
||||
1
src/main/resources/application-prod.properties
Normal file
1
src/main/resources/application-prod.properties
Normal file
@ -0,0 +1 @@
|
||||
api.baseUrl=https://cftunnels.hithomelabs.com
|
||||
1
src/main/resources/application-test.properties
Normal file
1
src/main/resources/application-test.properties
Normal file
@ -0,0 +1 @@
|
||||
api.baseUrl=https://testcf.hithomelabs.com
|
||||
@ -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}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user