@@ -60,6 +60,16 @@ pub fn initialize(
60
60
bits : NonZeroU16 ,
61
61
profiles : Vec < Profile > ,
62
62
) -> Result < ( ) , InitializationError > {
63
+ // This check is done here to avoid an empty config file being created in the case of an
64
+ // unsupported input.
65
+ if profiles. len ( ) != 1 {
66
+ // profiles are expected to be (comma separated) "test" as there are no bootstrap peer
67
+ // handling yet. the conformance test cases seem to init `go-ipfs` in this profile where
68
+ // it does not have any bootstrap nodes, and multi node tests later call swarm apis to
69
+ // dial the nodes together.
70
+ unimplemented ! ( "Multiple profiles are currently unsupported!" ) ;
71
+ }
72
+
63
73
let config_path = ipfs_path. join ( "config" ) ;
64
74
65
75
fs:: create_dir_all ( & ipfs_path)
@@ -79,6 +89,11 @@ fn create(
79
89
use prost:: Message ;
80
90
use std:: io:: BufWriter ;
81
91
92
+ let api_addrs = match profiles[ 0 ] {
93
+ Profile :: Test => "127.0.0.1:0" ,
94
+ Profile :: Default => "127.0.0.1:4004" ,
95
+ } ;
96
+
82
97
let bits = bits. get ( ) ;
83
98
84
99
if bits < 2048 || bits > 16 * 1024 {
@@ -124,19 +139,6 @@ fn create(
124
139
125
140
let private_key = Base64Pad . encode ( & private_key) ;
126
141
127
- if profiles. len ( ) != 1 {
128
- // profiles are expected to be (comma separated) "test" as there are no bootstrap peer
129
- // handling yet. the conformance test cases seem to init `go-ipfs` in this profile where
130
- // it does not have any bootstrap nodes, and multi node tests later call swarm apis to
131
- // dial the nodes together.
132
- unimplemented ! ( "Multiple profiles are currently unsupported!" )
133
- }
134
-
135
- let api_addrs = match profiles[ 0 ] {
136
- Profile :: Test => "127.0.0.1:0" ,
137
- Profile :: Default => "127.0.0.1:4004" ,
138
- } ;
139
-
140
142
let config_contents = CompatibleConfigFile {
141
143
identity : Identity {
142
144
peer_id,
0 commit comments