Skip to content

Commit

Permalink
Merge pull request #714 from overture-stack/rc/4.5.0
Browse files Browse the repository at this point in the history
rc 4.5.0 
Configurable swagger to run behind reverse proxy
  • Loading branch information
blabadi authored Mar 23, 2021
2 parents 52fe057 + 295e8f6 commit e22e55a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<groupId>bio.overture</groupId>
<artifactId>song</artifactId>
<packaging>pom</packaging>
<version>4.4.0</version>
<version>4.5.0</version>
<modules>
<module>song-core</module>
<module>song-java-sdk</module>
Expand Down
6 changes: 3 additions & 3 deletions song-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>song</artifactId>
<groupId>bio.overture</groupId>
<version>4.4.0</version>
<version>4.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -35,12 +35,12 @@
<dependency>
<groupId>bio.overture</groupId>
<artifactId>song-java-sdk</artifactId>
<version>4.4.0</version>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>bio.overture</groupId>
<artifactId>song-core</artifactId>
<version>4.4.0</version>
<version>4.5.0</version>
</dependency>

<!-- CLI -->
Expand Down
2 changes: 1 addition & 1 deletion song-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>song</artifactId>
<groupId>bio.overture</groupId>
<version>4.4.0</version>
<version>4.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion song-java-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<artifactId>song</artifactId>
<groupId>bio.overture</groupId>
<version>4.4.0</version>
<version>4.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 2 additions & 2 deletions song-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>song</artifactId>
<groupId>bio.overture</groupId>
<version>4.4.0</version>
<version>4.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -37,7 +37,7 @@
<dependency>
<groupId>bio.overture</groupId>
<artifactId>song-core</artifactId>
<version>4.4.0</version>
<version>4.5.0</version>
</dependency>

<!-- Spring -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.paths.RelativePathProvider;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger.web.UiConfiguration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
Expand All @@ -42,15 +43,30 @@ public class SwaggerConfig {
@Getter
private String alternateSwaggerUrl;

// default is empty
@Value("${swagger.host:}")
private String swaggerHost;

// default is empty
@Value("${swagger.basePath:}")
private String basePath;

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(basePackage("bio.overture.song.server.controller"))
.paths(any())
.build()
.pathMapping("/");
.host(swaggerHost)
.pathProvider(
new RelativePathProvider(null) {
@Override
public String getApplicationBasePath() {
return basePath;
}
}
);
}

@Bean
Expand Down
5 changes: 5 additions & 0 deletions song-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ management:

swagger:
alternateUrl: "/api-docs"
# host and base url are needed if you run song behind a reverse proxy
# and rewrite the url eg: http://mydomain.com/song/swagger-ui.html
# in this case host = mydomain.com, baseUrl = /song
host: ""
basePath: ""

security.basic.enabled: false

Expand Down

0 comments on commit e22e55a

Please sign in to comment.