1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-30 01:52:26 +08:00

Merge pull request #4845 from ipfs/fix/default-net-bootstrap

fix default-net profile not reverting bootstrap config
This commit is contained in:
Whyrusleeping
2018-04-09 09:02:45 +09:00
committed by GitHub
2 changed files with 24 additions and 6 deletions

View File

@ -86,6 +86,12 @@ Inverse profile of the test profile.`,
Transform: func(c *Config) error { Transform: func(c *Config) error {
c.Addresses = addressesConfig() c.Addresses = addressesConfig()
bootstrapPeers, err := DefaultBootstrapPeers()
if err != nil {
return err
}
c.Bootstrap = appendSingle(c.Bootstrap, BootstrapPeerStrings(bootstrapPeers))
c.Swarm.DisableNatPortMap = false c.Swarm.DisableNatPortMap = false
c.Discovery.MDNS.Enabled = true c.Discovery.MDNS.Enabled = true
return nil return nil
@ -156,14 +162,21 @@ fetching may be degraded.
} }
func appendSingle(a []string, b []string) []string { func appendSingle(a []string, b []string) []string {
m := map[string]struct{}{} out := make([]string, 0, len(a)+len(b))
m := map[string]bool{}
for _, f := range a { for _, f := range a {
m[f] = struct{}{} if !m[f] {
out = append(out, f)
}
m[f] = true
} }
for _, f := range b { for _, f := range b {
m[f] = struct{}{} if !m[f] {
out = append(out, f)
} }
return mapKeys(m) m[f] = true
}
return out
} }
func deleteEntries(arr []string, del []string) []string { func deleteEntries(arr []string, del []string) []string {

View File

@ -212,8 +212,13 @@ test_config_cmd() {
test_profile_apply_revert server local-discovery test_profile_apply_revert server local-discovery
# won't work as we already have this profile applied # tests above mess with values this profile changes, need to do that before testing test profile
# test_profile_apply_revert test test_expect_success "ensure test profile is applied fully" '
ipfs config profile apply test
'
# need to do this in reverse as the test profile is already applied in sharness
test_profile_apply_revert default-networking test
# won't work as it changes datastore definition, which makes ipfs not launch # won't work as it changes datastore definition, which makes ipfs not launch
# without converting first # without converting first