diff --git a/core/commands/config.go b/core/commands/config.go index 92acf4d2aaa..7776c16bb2a 100644 --- a/core/commands/config.go +++ b/core/commands/config.go @@ -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) }, } diff --git a/docs/config.md b/docs/config.md index 99f62de40c0..bb8dc5ca325 100644 --- a/docs/config.md +++ b/docs/config.md @@ -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 diff --git a/repo/config/profile.go b/repo/config/profile.go index 061a41408eb..529cf3a97d3 100644 --- a/repo/config/profile.go +++ b/repo/config/profile.go @@ -64,6 +64,7 @@ var Profiles = map[string]*Profile{ c.Addresses = addressesConfig() c.Swarm.DisableNatPortMap = false + c.Discovery.MDNS.Enabled = true return nil }, }, diff --git a/test/sharness/t0021-config.sh b/test/sharness/t0021-config.sh index be1ce81585b..a7ff59bcfcb 100755 --- a/test/sharness/t0021-config.sh +++ b/test/sharness/t0021-config.sh @@ -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