Skip to content

Commit 75adf58

Browse files
committed
add items to config api
1 parent 61bd49b commit 75adf58

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/io/ipfs/api/IPFS.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,21 @@ public Map log() throws IOException {
740740
return retrieveMap("log/tail");
741741
}
742742

743+
public Map config(String entry, Optional<String> value, Optional<Boolean> setBool) throws IOException {
744+
String valArg = value.isPresent() ? "&arg=" + value.get() : "";
745+
String setBoolArg = setBool.isPresent() ? "&arg=" + setBool.get() : "";
746+
return retrieveMap("config?arg=" + entry + valArg + setBoolArg);
747+
}
748+
743749
public class Config {
744750
public Map show() throws IOException {
745751
return (Map)retrieveAndParse("config/show");
746752
}
747753

754+
public Map profileApply(String profile, boolean dryRun) throws IOException {
755+
return (Map)retrieveAndParse("config/profile/apply?arg="+profile + "&dry-run" + dryRun);
756+
}
757+
748758
public void replace(NamedStreamable file) throws IOException {
749759
Multipart m = new Multipart(protocol +"://" + host + ":" + port + version+"config/replace?stream-channels=true", "UTF-8");
750760
m.addFilePart("file", Paths.get(""), file);

src/test/java/io/ipfs/api/APITest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,10 @@ public void diagTest() throws IOException {
761761
// Object log = ipfs.log();
762762
String sys = ipfs.diag.sys();
763763
String cmds = ipfs.diag.cmds();
764+
765+
//String profile = "default";
766+
//ipfs.config.profileApply(profile, true);
767+
//Map entry = ipfs.config("Addresses.API", Optional.of("/ip4/127.0.0.1/tcp/5001"), Optional.empty());
764768
}
765769

766770
@Test

0 commit comments

Comments
 (0)