Skip to content

Commit b6f0156

Browse files
Updated to webdav 0.2.2, allowing the CLI version to accept connections from foreign hosts.
1 parent abf7601 commit b6f0156

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
<properties>
1111
<java.version>1.8</java.version>
12+
<commons.cli.version>1.3.1</commons.cli.version>
13+
<cryptofs.version>1.0.0</cryptofs.version>
14+
<webdav-nio.version>0.2.2</webdav-nio.version>
1215
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1316
</properties>
1417

@@ -34,19 +37,19 @@
3437
<dependency>
3538
<groupId>org.cryptomator</groupId>
3639
<artifactId>cryptofs</artifactId>
37-
<version>0.1.6</version>
40+
<version>${cryptofs.version}</version>
3841
</dependency>
3942
<dependency>
4043
<groupId>org.cryptomator</groupId>
4144
<artifactId>webdav-nio-adapter</artifactId>
42-
<version>0.1.0</version>
45+
<version>${webdav-nio.version}</version>
4346
</dependency>
4447

4548
<!-- Commons -->
4649
<dependency>
4750
<groupId>commons-cli</groupId>
4851
<artifactId>commons-cli</artifactId>
49-
<version>1.3.1</version>
52+
<version>${commons.cli.version}</version>
5053
</dependency>
5154

5255
<!-- Logging -->

src/main/java/org/cryptomator/cli/Args.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@
2525
public class Args {
2626

2727
private static final String USAGE = "java -jar cryptomator-cli.jar" //
28+
+ " --bind localhost --port 8080" //
2829
+ " --vault mySecretVault=/path/to/vault --password mySecretVault=FooBar3000" //
2930
+ " --vault myOtherVault=/path/to/other/vault --password myOtherVault=BarFoo4000";
3031
private static final Options OPTIONS = new Options();
3132
static {
33+
OPTIONS.addOption(Option.builder() //
34+
.longOpt("bind") //
35+
.argName("WebDAV bind address") //
36+
.desc("TCP socket bind address of the WebDAV server. Use 0.0.0.0 to accept all incoming connections.") //
37+
.hasArg() //
38+
.build());
3239
OPTIONS.addOption(Option.builder() //
3340
.longOpt("port") //
3441
.argName("WebDAV port") //
@@ -51,16 +58,22 @@ public class Args {
5158
.build());
5259
}
5360

61+
private final String bindAddr;
5462
private final int port;
5563
private final Properties vaultPaths;
5664
private final Properties vaultPasswords;
5765

5866
public Args(CommandLine commandLine) throws ParseException {
67+
this.bindAddr = commandLine.getOptionValue("bind", "localhost");
5968
this.port = Integer.parseInt(commandLine.getOptionValue("port", "0"));
6069
this.vaultPaths = commandLine.getOptionProperties("vault");
6170
this.vaultPasswords = commandLine.getOptionProperties("password");
6271
}
6372

73+
public String getBindAddr() {
74+
return bindAddr;
75+
}
76+
6477
public int getPort() {
6578
return port;
6679
}

src/main/java/org/cryptomator/cli/CryptomatorCli.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private static void validate(Args args) throws IllegalArgumentException {
5656
}
5757

5858
private static void startup(Args args) throws IOException {
59-
WebDavServer server = WebDavServer.create(args.getPort());
59+
WebDavServer server = WebDavServer.create(args.getBindAddr(), args.getPort());
6060
server.start();
6161

6262
for (String vaultName : args.getVaultNames()) {

0 commit comments

Comments
 (0)