Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
2514c747
Commit
2514c747
authored
Nov 25, 2017
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config-patch: apply review suggestions
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
c573d3d0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
9 deletions
+59
-9
core/commands/config.go
core/commands/config.go
+3
-1
docs/config.md
docs/config.md
+21
-8
repo/config/profile.go
repo/config/profile.go
+1
-0
test/sharness/t0021-config.sh
test/sharness/t0021-config.sh
+34
-0
No files found.
core/commands/config.go
View file @
2514c747
...
@@ -324,13 +324,14 @@ var configProfileApplyCmd = &cmds.Command{
...
@@ -324,13 +324,14 @@ var configProfileApplyCmd = &cmds.Command{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
return
}
}
res
.
SetOutput
(
nil
)
},
},
}
}
var
configProfileRevertCmd
=
&
cmds
.
Command
{
var
configProfileRevertCmd
=
&
cmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Revert profile changes."
,
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.
Reverting some profiles may damage the configuration or not be possible.
Backing up the config before running this command is advised.`
,
Backing up the config before running this command is advised.`
,
...
@@ -350,6 +351,7 @@ 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
)
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
return
}
}
res
.
SetOutput
(
nil
)
},
},
}
}
...
...
docs/config.md
View file @
2514c747
...
@@ -9,14 +9,27 @@ Configuration profiles allow to tweak configuration quickly. Profiles can be
...
@@ -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`
applied with
`--profile`
flag to
`ipfs init`
or with
`ipfs config profile apply`
command.
command.
-
`server`
profile
Available profiles:
Recommended for nodes with public IPv4 address, disables host and content
-
`server`
discovery in local networks.
Recommended for nodes with public IPv4 address, disables host and content
-
`test`
profile
discovery in local networks.
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
-
`test`
network without manual bootstrap.
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
## Table of Contents
...
...
repo/config/profile.go
View file @
2514c747
...
@@ -64,6 +64,7 @@ var Profiles = map[string]*Profile{
...
@@ -64,6 +64,7 @@ var Profiles = map[string]*Profile{
c
.
Addresses
=
addressesConfig
()
c
.
Addresses
=
addressesConfig
()
c
.
Swarm
.
DisableNatPortMap
=
false
c
.
Swarm
.
DisableNatPortMap
=
false
c
.
Discovery
.
MDNS
.
Enabled
=
true
return
nil
return
nil
},
},
},
},
...
...
test/sharness/t0021-config.sh
View file @
2514c747
...
@@ -48,6 +48,32 @@ CONFIG_SET_JSON_TEST='{
...
@@ -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
()
{
test_config_cmd_set
"beep"
"boop"
test_config_cmd_set
"beep"
"boop"
test_config_cmd_set
"beep1"
"boop2"
test_config_cmd_set
"beep1"
"boop2"
...
@@ -175,6 +201,14 @@ test_config_cmd() {
...
@@ -175,6 +201,14 @@ test_config_cmd() {
test $(cat actual_config | wc -l) = 1
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
test_init_ipfs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment