m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin <marcin.j.chrzanowski@gmail.com>2019-11-27 23:18:27 +0100
committerGitHub <noreply@github.com>2019-11-27 23:18:27 +0100
commit0cff4e616cdf5f3ea4506e828c891baa4556b38c (patch)
tree6e203992404cca6fda7beb3d29070092ffdeff3c
parent3ce9014da9d789b1ba9c03c6dcc8c663576353e3 (diff)
Set default hostname (#45)
-rw-r--r--README.md3
-rw-r--r--build.gradle10
2 files changed, 10 insertions, 3 deletions
diff --git a/README.md b/README.md
index 1f46676..47cdd3e 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,9 @@
## Running
+The agent, fetcher, and interpreter take an optional `-Dhostname=<agent's external hostname`
+argument, which defaults to `localhost`.
+
### API Agent
# start rmiregistry
diff --git a/build.gradle b/build.gradle
index 2195aee..82a430e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,6 +14,10 @@ plugins {
id 'application'
}
+ext.hostname = {
+ return System.getProperty("hostname") ?: "localhost"
+}
+
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
@@ -49,19 +53,19 @@ application {
task runAgent(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'pl.edu.mimuw.cloudatlas.agent.Agent'
- systemProperty 'java.rmi.server.hostname', System.getProperty('hostname')
+ systemProperty 'java.rmi.server.hostname', hostname()
}
task runClient(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'pl.edu.mimuw.cloudatlas.client.Client'
- systemProperty 'agent_hostname', System.getProperty('hostname')
+ systemProperty 'agent_hostname', hostname()
}
task runFetcher(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'pl.edu.mimuw.cloudatlas.fetcher.Fetcher'
- args(System.getProperty('hostname'), 1099)
+ args(hostname() , 1099)
}
task runInterpreter(type: JavaExec) {