[online] Honor generator environment variable and system property (#3265)

Previously, this pulled from the GENERATOR_HOST system property. This
should have been an environment variable. Fallback is now generator.host
system property.
This commit is contained in:
Jim Schubert 2019-07-02 13:07:17 -04:00 committed by GitHub
parent b87806834b
commit 1fc7740f2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,11 @@ public class OpenAPIDocumentationConfig {
public Docket customImplementation(){
String host;
try {
host = new URI(System.getProperty("GENERATOR_HOST", "http://localhost")).getHost();
String baseUrl = System.getenv("GENERATOR_HOST");
if (baseUrl == null) {
baseUrl = System.getProperty("generator.host", "http://localhost");
}
host = new URI(baseUrl).getHost();
} catch (URISyntaxException e) {
host = "";
}