override the generated url by swagger
This commit is contained in:
parent
7a83fb8c67
commit
6c3b7d6e7c
|
@ -1,6 +1,9 @@
|
||||||
server.servlet.context-path=/bioschemas-api
|
server.servlet.context-path=/bioschemas-api
|
||||||
server.port=8281
|
server.port=8281
|
||||||
|
|
||||||
|
server.public_url = http://localhost:8281/bioschemas-api
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
spring.profiles.active=garr
|
spring.profiles.active=garr
|
||||||
|
|
||||||
logging.file.name = /var/log/bioschemas-api/bioschemas.log
|
logging.file.name = /var/log/bioschemas-api/bioschemas.log
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
spring.profiles.active = dev,openaire
|
spring.profiles.active = dev,openaire
|
||||||
|
|
||||||
|
server.public_url =
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
#logging.level.root=DEBUG
|
#logging.level.root=DEBUG
|
||||||
|
|
||||||
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dhp-broker-application/effective-pom.xml
|
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dhp-broker-application/effective-pom.xml
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
spring.profiles.active = dev,openaire
|
spring.profiles.active = dev,openaire
|
||||||
|
|
||||||
|
server.public_url =
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
#logging.level.root=DEBUG
|
#logging.level.root=DEBUG
|
||||||
|
|
||||||
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dhp-broker-public-application/effective-pom.xml
|
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dhp-broker-public-application/effective-pom.xml
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
spring.main.banner-mode = console
|
spring.main.banner-mode = console
|
||||||
|
|
||||||
|
server.public_url =
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
logging.level.root = INFO
|
logging.level.root = INFO
|
||||||
|
|
||||||
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dhp-mdstore-manager/effective-pom.xml
|
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dhp-mdstore-manager/effective-pom.xml
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
server.servlet.context-path = /openaire
|
server.servlet.context-path = /openaire
|
||||||
server.port = 8080
|
server.port = 8080
|
||||||
|
|
||||||
|
server.public_url =
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
spring.datasource.driverClassName = org.postgresql.Driver
|
spring.datasource.driverClassName = org.postgresql.Driver
|
||||||
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL9Dialect
|
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL9Dialect
|
||||||
spring.jpa.show-sql = false
|
spring.jpa.show-sql = false
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
server.port=8480
|
server.port=8480
|
||||||
|
|
||||||
|
server.public_url = http://localhost:8480
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
spring.profiles.active=dev
|
spring.profiles.active=dev
|
||||||
|
|
||||||
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-orgs-database-application/effective-pom.xml
|
maven.pom.path = /META-INF/maven/eu.dnetlib.dhp/dnet-orgs-database-application/effective-pom.xml
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
spring.main.banner-mode = console
|
spring.main.banner-mode = console
|
||||||
|
|
||||||
|
server.public_url =
|
||||||
|
server.public_desc = API Base URL
|
||||||
|
|
||||||
logging.level.root = INFO
|
logging.level.root = INFO
|
||||||
dhp.swagger.api.host = localhost:8080
|
dhp.swagger.api.host = localhost:8080
|
||||||
#dhp.swagger.api.host = api.scholexplorer.openaire.eu
|
#dhp.swagger.api.host = api.scholexplorer.openaire.eu
|
||||||
|
|
|
@ -19,9 +19,11 @@ import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
import io.micrometer.core.instrument.ImmutableTag;
|
import io.micrometer.core.instrument.ImmutableTag;
|
||||||
import io.micrometer.core.instrument.Metrics;
|
import io.micrometer.core.instrument.Metrics;
|
||||||
|
import io.micrometer.core.instrument.util.StringUtils;
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.info.Info;
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
import io.swagger.v3.oas.models.info.License;
|
import io.swagger.v3.oas.models.info.License;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
import io.swagger.v3.oas.models.tags.Tag;
|
import io.swagger.v3.oas.models.tags.Tag;
|
||||||
|
|
||||||
public abstract class AbstractDnetApp {
|
public abstract class AbstractDnetApp {
|
||||||
|
@ -35,6 +37,12 @@ public abstract class AbstractDnetApp {
|
||||||
@Value("${maven.pom.path}")
|
@Value("${maven.pom.path}")
|
||||||
private ClassPathResource pom;
|
private ClassPathResource pom;
|
||||||
|
|
||||||
|
@Value("${server.public_url}")
|
||||||
|
private String serverPublicUrl;
|
||||||
|
|
||||||
|
@Value("${server.public_desc}")
|
||||||
|
private String serverPublicDesc;
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(AbstractDnetApp.class);
|
private static final Logger log = LoggerFactory.getLogger(AbstractDnetApp.class);
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
@ -57,7 +65,16 @@ public abstract class AbstractDnetApp {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public OpenAPI newSwaggerDocket() {
|
public OpenAPI newSwaggerDocket() {
|
||||||
|
final List<Server> servers = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotBlank(serverPublicUrl)) {
|
||||||
|
final Server server = new Server();
|
||||||
|
server.setUrl(serverPublicUrl);
|
||||||
|
server.setDescription(serverPublicDesc);
|
||||||
|
servers.add(server);
|
||||||
|
}
|
||||||
|
|
||||||
return new OpenAPI()
|
return new OpenAPI()
|
||||||
|
.servers(servers)
|
||||||
.info(getSwaggerInfo())
|
.info(getSwaggerInfo())
|
||||||
.tags(swaggerTags());
|
.tags(swaggerTags());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue