Skip to content

Commit

Permalink
[online] Honor GENERATOR_HOST env variable (#3263)
Browse files Browse the repository at this point in the history
This sets "host" appropriately to the published host when GENERATOR_HOST
is configured.
  • Loading branch information
jimschubert committed Jul 2, 2019
1 parent 4e62e92 commit b878068
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -31,6 +31,8 @@

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Properties;


Expand Down Expand Up @@ -64,7 +66,14 @@ ApiInfo apiInfo() {

@Bean
public Docket customImplementation(){
String host;
try {
host = new URI(System.getProperty("GENERATOR_HOST", "http://localhost")).getHost();
} catch (URISyntaxException e) {
host = "";
}
return new Docket(DocumentationType.SWAGGER_2)
.host(host)
.select()
.apis(RequestHandlerSelectors.basePackage("org.openapitools.codegen.online.api"))
.build()
Expand Down

0 comments on commit b878068

Please sign in to comment.