Skip to content

Commit 24be69b

Browse files
committed
config: apply review to lowpower profile
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
1 parent 440d542 commit 24be69b

File tree

9 files changed

+15
-10
lines changed

9 files changed

+15
-10
lines changed

cmd/ipfs/daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
308308
return
309309
}
310310

311-
routingOption = cfg.Discovery.Routing
311+
routingOption = cfg.Routing.Type
312312
if routingOption == "" {
313313
routingOption = routingOptionDHTKwd
314314
}

docs/config.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ Valid modes are:
153153
- `dht` (default)
154154
- `dhtclient`
155155
- `none`
156-
- `supernode` (deprecated)
157156

158157
## `Gateway`
159158
Options for the HTTP gateway.

repo/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Config struct {
1919
Addresses Addresses // local node's addresses
2020
Mounts Mounts // local node's mount points
2121
Discovery Discovery // local node's discovery mechanisms
22+
Routing Routing // local node's routing settings
2223
Ipns Ipns // Ipns settings
2324
Bootstrap []string // local nodes's bootstrap peer addresses
2425
Gateway Gateway // local node's gateway server options

repo/config/discovery.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ package config
22

33
type Discovery struct {
44
MDNS MDNS
5-
6-
//Routing sets default daemon routing mode.
7-
Routing string
85
}
96

107
type MDNS struct {

repo/config/init.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
4848
Enabled: true,
4949
Interval: 10,
5050
},
51-
Routing: "dht",
51+
},
52+
53+
Routing: Routing{
54+
Type: "dht",
5255
},
5356

5457
// setup the node mount points.

repo/config/profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var ConfigProfiles = map[string]func(*Config) error{
5454
return nil
5555
},
5656
"lowpower": func(c *Config) error {
57-
c.Discovery.Routing = "dhtclient"
57+
c.Routing.Type = "dhtclient"
5858
c.Reprovider.Interval = "0"
5959
return nil
6060
},

repo/config/routing.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package config
2+
3+
type Routing struct {
4+
// Type sets default daemon routing mode.
5+
Type string
6+
}

test/sharness/t0020-init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ test_expect_success "'ipfs init --profile=lowpower' succeeds" '
173173
'
174174

175175
test_expect_success "'ipfs config Discovery.Routing' looks good" '
176-
ipfs config Discovery.Routing > actual_config &&
176+
ipfs config Routing.Type > actual_config &&
177177
test $(cat actual_config) = "dhtclient"
178178
'
179179

test/sharness/t0021-config.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ CONFIG_SET_JSON_TEST='{
4545
"MDNS": {
4646
"Enabled": true,
4747
"Interval": 10
48-
},
49-
"Routing": "dht"
48+
}
5049
}'
5150

5251
test_config_cmd() {

0 commit comments

Comments
 (0)