diff --git a/CHANGELOG.md b/CHANGELOG.md
index b76433cd4..baffd2ddc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+
+# [35.1.0](https://github.com/ipfs/js-ipfs-http-client/compare/v35.0.0...v35.1.0) (2019-09-04)
+
+
+### Features
+
+* add config profile endpoint ([#1030](https://github.com/ipfs/js-ipfs-http-client/issues/1030)) ([3aaa3ee](https://github.com/ipfs/js-ipfs-http-client/commit/3aaa3ee))
+
+
+
# [35.0.0](https://github.com/ipfs/js-ipfs-http-client/compare/v34.0.0...v35.0.0) (2019-09-04)
diff --git a/package.json b/package.json
index e88dcf56d..91ebcd75f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ipfs-http-client",
- "version": "35.0.0",
+ "version": "35.1.0",
"description": "A client library for the IPFS HTTP API",
"keywords": [
"ipfs"
diff --git a/src/config/index.js b/src/config/index.js
index 109865ab0..d690d8099 100644
--- a/src/config/index.js
+++ b/src/config/index.js
@@ -8,6 +8,7 @@ module.exports = (arg) => {
return {
get: require('./get')(send),
set: require('./set')(send),
- replace: require('./replace')(send)
+ replace: require('./replace')(send),
+ profile: require('./profile')(send)
}
}
diff --git a/src/config/profile.js b/src/config/profile.js
new file mode 100644
index 000000000..809adb5d4
--- /dev/null
+++ b/src/config/profile.js
@@ -0,0 +1,41 @@
+'use strict'
+
+const promisify = require('promisify-es6')
+
+const toObject = function (res, callback) {
+ if (Buffer.isBuffer(res)) {
+ callback(null, JSON.parse(res.toString()))
+ } else {
+ callback(null, res)
+ }
+}
+
+module.exports = (send) => {
+ return promisify((profile, opts, callback) => {
+ if (typeof opts === 'function') {
+ callback = opts
+ opts = {}
+ }
+
+ opts = normalizeOpts(opts)
+
+ send.andTransform({
+ path: 'config/profile/apply',
+ args: profile,
+ qs: opts
+ }, toObject, (err, response) => {
+ if (err) {
+ return callback(err)
+ }
+ callback(null, { oldCfg: response.OldCfg, newCfg: response.NewCfg })
+ })
+ })
+}
+
+function normalizeOpts (opts) {
+ opts = opts || {}
+ if (typeof opts.dryRun !== 'undefined') {
+ opts['dry-run'] = opts.dryRun
+ }
+ return opts
+}
diff --git a/test/interface.spec.js b/test/interface.spec.js
index 32c6f6749..c51fc7e39 100644
--- a/test/interface.spec.js
+++ b/test/interface.spec.js
@@ -49,11 +49,6 @@ describe('interface-ipfs-core tests', () => {
{
name: 'replace',
reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-http-client/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927'
- },
- // config.profile
- {
- name: 'profile',
- reason: 'TODO not yet implemented https://github.com/ipfs/js-ipfs-http-client/pull/1030'
}
]
})
diff --git a/test/sub-modules.spec.js b/test/sub-modules.spec.js
index cabd09b55..b066b6278 100644
--- a/test/sub-modules.spec.js
+++ b/test/sub-modules.spec.js
@@ -42,6 +42,7 @@ describe('submodules', () => {
expect(cfg.get).to.be.a('function')
expect(cfg.set).to.be.a('function')
expect(cfg.replace).to.be.a('function')
+ expect(cfg.profile).to.be.a('function')
})
it('dht', () => {