mirror of
https://github.com/OpenLiberty/liberty-bikes.git
synced 2025-01-18 10:23:58 +08:00
Use external IP address for open task
This commit is contained in:
parent
ab54fe6682
commit
5c0f8b8a40
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
httpPort = 8082
|
||||
httpsPort = 8482
|
||||
appUrl = "http://localhost:${httpPort}/openapi/ui"
|
||||
appUrl = "http://${hostname}:${httpPort}/openapi/ui"
|
||||
}
|
||||
|
||||
liberty {
|
||||
|
16
build.gradle
16
build.gradle
@ -12,6 +12,22 @@ task clean(type: Delete) {
|
||||
delete 'build'
|
||||
}
|
||||
|
||||
ext.hostname = 'localhost'
|
||||
// Find the public IP address for this machine (if one exists)
|
||||
NetworkInterface.getNetworkInterfaces()
|
||||
.findAll { it.isUp() && !it.isLoopback() && !it.isVirtual() }
|
||||
.each {
|
||||
it.getInetAddresses()
|
||||
.findAll { !it.isLoopbackAddress() && it instanceof Inet4Address }
|
||||
.each {
|
||||
if (hostname.equals('localhost')) {
|
||||
def hn = it.toString();
|
||||
hostname = hn.startsWith("/") ? hn.substring(1, hn.length()) : hn;
|
||||
// ${it} is in the format /<IP>, so only use http:/ instead of http://
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'liberty'
|
||||
apply plugin: 'war'
|
||||
|
@ -19,7 +19,7 @@ ext {
|
||||
httpPort = 12000
|
||||
httpsPort = 12005
|
||||
applicationName = "${war.archiveName}"
|
||||
appUrl = "http://localhost:${httpPort}/"
|
||||
appUrl = "http://${hostname}:${httpPort}/"
|
||||
}
|
||||
|
||||
war {
|
||||
|
@ -6,7 +6,7 @@ dependencies {
|
||||
ext {
|
||||
httpPort = 8080
|
||||
httpsPort = 8443
|
||||
appUrl = "http://localhost:${httpPort}/openapi/ui"
|
||||
appUrl = "http://${hostname}:${httpPort}/openapi/ui"
|
||||
}
|
||||
|
||||
liberty {
|
||||
|
@ -1,7 +1,7 @@
|
||||
ext {
|
||||
httpPort = 8081
|
||||
httpsPort = 8444
|
||||
appUrl = "http://localhost:${httpPort}/openapi/ui"
|
||||
appUrl = "http://${hostname}:${httpPort}/openapi/ui"
|
||||
}
|
||||
|
||||
liberty {
|
||||
|
Loading…
Reference in New Issue
Block a user