Commit 2514c747 authored by Łukasz Magiera's avatar Łukasz Magiera

config-patch: apply review suggestions

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent c573d3d0
......@@ -324,13 +324,14 @@ var configProfileApplyCmd = &cmds.Command{
res.SetError(err, cmdkit.ErrNormal)
return
}
res.SetOutput(nil)
},
}
var configProfileRevertCmd = &cmds.Command{
Helptext: cmdkit.HelpText{
Tagline: "Revert profile changes.",
ShortDescription: `Reverts profile-related changes to the config.
ShortDescription: `Reverts profile-related changes to the default values.
Reverting some profiles may damage the configuration or not be possible.
Backing up the config before running this command is advised.`,
......@@ -350,6 +351,7 @@ Backing up the config before running this command is advised.`,
res.SetError(err, cmdkit.ErrNormal)
return
}
res.SetOutput(nil)
},
}
......
......@@ -9,14 +9,27 @@ Configuration profiles allow to tweak configuration quickly. Profiles can be
applied with `--profile` flag to `ipfs init` or with `ipfs config profile apply`
command.
- `server` profile
Recommended for nodes with public IPv4 address, disables host and content
discovery in local networks.
- `test` profile
Reduces external interference, useful for running ipfs in test environments.
Note that with these settings node won't be able to talk to the rest of the
network without manual bootstrap.
Available profiles:
- `server`
Recommended for nodes with public IPv4 address, disables host and content
discovery in local networks.
- `test`
Reduces external interference, useful for running ipfs in test environments.
Note that with these settings node won't be able to talk to the rest of the
network without manual bootstrap.
- `badgerds`
Replaces default datastore configuration with experimental badger datastore.
If you apply this profile after `ipfs init`, you will need to convert your
datastore to the new configuration. You can do this using [ipfs-ds-convert](https://github.com/ipfs/ipfs-ds-convert)
WARNING: badger datastore is experimantal. Make sure to backup your data
frequently
## Table of Contents
......
......@@ -64,6 +64,7 @@ var Profiles = map[string]*Profile{
c.Addresses = addressesConfig()
c.Swarm.DisableNatPortMap = false
c.Discovery.MDNS.Enabled = true
return nil
},
},
......
......@@ -48,6 +48,32 @@ CONFIG_SET_JSON_TEST='{
}
}'
test_profile_apply_revert() {
profile=$1
test_expect_success "save expected config" '
ipfs config show >expected
'
test_expect_success "'ipfs config profile apply ${profile}' works" '
ipfs config profile apply '${profile}'
'
test_expect_success "profile ${profile} changed something" '
ipfs config show >actual &&
test_must_fail test_cmp expected actual
'
test_expect_success "'ipfs config profile revert ${profile}' works" '
ipfs config profile revert '${profile}'
'
test_expect_success "config is back to previous state after ${profile} revert" '
ipfs config show >actual &&
test_cmp expected actual
'
}
test_config_cmd() {
test_config_cmd_set "beep" "boop"
test_config_cmd_set "beep1" "boop2"
......@@ -175,6 +201,14 @@ test_config_cmd() {
test $(cat actual_config | wc -l) = 1
'
test_profile_apply_revert server
# won't work as we already have this profile applied
# test_profile_apply_revert test
# won't work as it changes datastore definition, which makes ipfs not launch
# without converting first
# test_profile_apply_revert badgerds
}
test_init_ipfs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment