@@ -25,9 +25,9 @@ import {
2525 CryptoUtils ,
2626 CustomPreset ,
2727 DeepPartial ,
28+ FaucetPreset ,
2829 FileSystemService ,
2930 Logger ,
30- NodePreset ,
3131 Password ,
3232 PeerInfo ,
3333 PrivateKeySecurityMode ,
@@ -82,19 +82,21 @@ export class NetworkConfigurationService {
8282 const metadata = nodesMetadata [ nodeTypeInput . nodeType ] ;
8383 const assembly = NodeMetadataUtils . getAssembly ( metadata ) ;
8484
85- const customPreset : CustomPreset = {
86- privateKeySecurityMode : PrivateKeySecurityMode . PROMPT_MAIN_TRANSPORT ,
87- nodes : [
88- {
89- friendlyName : friendlyName ,
90- host : hostname ,
91- voting : metadata . voting ,
92- harvesting : metadata . harvesting ,
93- dockerComposeDebugMode : false ,
94- brokerDockerComposeDebugMode : false ,
95- } ,
96- ] ,
97- } ;
85+ const customPreset : CustomPreset = metadata . services
86+ ? { domain : input . domain }
87+ : {
88+ privateKeySecurityMode : PrivateKeySecurityMode . PROMPT_MAIN_TRANSPORT ,
89+ nodes : [
90+ {
91+ friendlyName : friendlyName ,
92+ host : hostname ,
93+ voting : metadata . voting ,
94+ harvesting : metadata . harvesting ,
95+ dockerComposeDebugMode : false ,
96+ brokerDockerComposeDebugMode : false ,
97+ } ,
98+ ] ,
99+ } ;
98100 if ( metadata . api && nodeTypeInput . restProtocol == RestProtocol . HttpsOnly ) {
99101 customPreset . gateways = [
100102 {
@@ -164,7 +166,7 @@ export class NetworkConfigurationService {
164166 return output ;
165167 }
166168
167- public async updateNodes ( { nodePassword, offline, composeUser, zip } : UpdateNodesParams ) : Promise < void > {
169+ public async configureNodes ( { nodePassword, offline, composeUser, zip } : UpdateNodesParams ) : Promise < void > {
168170 const input = await NetworkUtils . loadNetwork ( this . workingDir ) ;
169171 const networkPreset = ConfigLoader . loadNetworkPreset ( input . preset , this . workingDir ) ;
170172 const customNetwork = YamlUtils . isYmlFile ( input . preset ) ;
@@ -183,25 +185,20 @@ export class NetworkConfigurationService {
183185
184186 const toStoreCustomPreset = CryptoUtils . removePrivateKeys ( node . customPreset ) as CustomPreset ;
185187
186- const nodeCustomPreset : DeepPartial < NodePreset > | undefined = toStoreCustomPreset ?. nodes ?. [ 0 ] ;
187- if ( ! nodeCustomPreset ) {
188- throw new Error ( `Node's custom preset cannot be found!` ) ;
189- }
190-
191188 const metadata = nodesMetadata [ node . nodeType ] ;
192- if ( metadata . demo ) {
189+ if ( metadata . demo || metadata . services ) {
193190 const faucetAccount = input . faucetBalances
194191 ? await this . keyStore . getNetworkAccount ( input . networkType , 'faucet' , true )
195192 : undefined ;
196- toStoreCustomPreset . faucets = [
197- _ . merge (
198- {
199- repeat : faucetAccount ? 1 : 0 ,
200- privateKey : faucetAccount ?. privateKey ,
193+ const faucetCustomPreset : DeepPartial < FaucetPreset > = {
194+ repeat : faucetAccount ? 1 : 0 ,
195+ compose : {
196+ environment : {
197+ FAUCET_PRIVATE_KEY : faucetAccount ?. privateKey ,
201198 } ,
202- toStoreCustomPreset . faucets ?. [ 0 ] ,
203- ) ,
204- ] ;
199+ } ,
200+ } ;
201+ toStoreCustomPreset . faucets = [ _ . merge ( faucetCustomPreset , toStoreCustomPreset . faucets ?. [ 0 ] ) ] ;
205202 }
206203
207204 if ( input . nemesisSeedFolder ) {
@@ -241,18 +238,22 @@ export class NetworkConfigurationService {
241238 {
242239 user : composeUser || ConfigService . defaultParams . user ,
243240 target : bootstrapTargetFolder ,
241+ offline : offline ,
244242 upgrade : true ,
245243 workingDir : this . workingDir ,
246244 password : nodePassword as string ,
247245 } ,
248246 result . presetData ,
249247 result . addresses ,
250248 ) ;
251- const nodeAddresses = result . addresses . nodes ?. [ 0 ] ;
252- if ( ! nodeAddresses ) {
253- throw new Error ( 'Node addresses should have been resolved!!!' ) ;
249+ if ( ! metadata . services ) {
250+ const nodeAddresses = result . addresses . nodes ?. [ 0 ] ;
251+ if ( ! nodeAddresses ) {
252+ throw new Error ( 'Node addresses should have been resolved!!!' ) ;
253+ }
254+ node . addresses = nodeAddresses ;
254255 }
255- node . addresses = nodeAddresses ;
256+
256257 if ( zip ) {
257258 const zipName = `${ hostname } .zip` ;
258259 const zipDir = `${ this . workingDir } /distribution` ;
0 commit comments