@@ -100,27 +100,30 @@ func keyCmdRun(_ *cobra.Command, _ []string) {
100100 }
101101 log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , model .PathNodeID )
102102
103- err = common .WriteJSON (fmt .Sprintf (model .PathNodeInfoPriv , nodeInfo .NodeID ), flagOutdir , private )
103+ privKeyPath := fmt .Sprintf (model .PathNodeInfoPriv , nodeInfo .NodeID )
104+ err = common .WriteJSON (privKeyPath , flagOutdir , private )
104105 if err != nil {
105106 log .Fatal ().Err (err ).Msg ("failed to write json" )
106107 }
107- log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , model . PathNodeInfoPriv )
108+ log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , privKeyPath )
108109
109- err = common .WriteText (fmt .Sprintf (model .PathSecretsEncryptionKey , nodeInfo .NodeID ), flagOutdir , secretsDBKey )
110+ secretsKeyPath := fmt .Sprintf (model .PathSecretsEncryptionKey , nodeInfo .NodeID )
111+ err = common .WriteText (secretsKeyPath , flagOutdir , secretsDBKey )
110112 if err != nil {
111113 log .Fatal ().Err (err ).Msg ("failed to write file" )
112114 }
113- log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , model . PathSecretsEncryptionKey )
115+ log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , secretsKeyPath )
114116
115117 public , err := nodeInfo .Public ()
116118 if err != nil {
117119 log .Fatal ().Err (err ).Msg ("could not access public keys" )
118120 }
119- err = common .WriteJSON (fmt .Sprintf (model .PathNodeInfoPub , nodeInfo .NodeID ), flagOutdir , public )
121+ pubNodeInfoPath := fmt .Sprintf (model .PathNodeInfoPub , nodeInfo .NodeID )
122+ err = common .WriteJSON (pubNodeInfoPath , flagOutdir , public )
120123 if err != nil {
121124 log .Fatal ().Err (err ).Msg ("failed to write json" )
122125 }
123- log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , model . PathNodeInfoPub )
126+ log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , pubNodeInfoPath )
124127
125128 // write machine account info
126129 if role == flow .RoleCollection || role == flow .RoleConsensus {
@@ -134,11 +137,12 @@ func keyCmdRun(_ *cobra.Command, _ []string) {
134137 log .Debug ().Str ("address" , flagAddress ).Msg ("assembling machine account information" )
135138 // write the public key to terminal for entry in Flow Port
136139 machineAccountPriv := assembleNodeMachineAccountKey (machineKey )
137- err = common .WriteJSON (fmt .Sprintf (model .PathNodeMachineAccountPrivateKey , nodeInfo .NodeID ), flagOutdir , machineAccountPriv )
140+ privateKeyPath := fmt .Sprintf (model .PathNodeMachineAccountPrivateKey , nodeInfo .NodeID )
141+ err = common .WriteJSON (privateKeyPath , flagOutdir , machineAccountPriv )
138142 if err != nil {
139143 log .Fatal ().Err (err ).Msg ("failed to write json" )
140144 }
141- log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , model . PathNodeMachineAccountPrivateKey )
145+ log .Info ().Msgf ("wrote file %s/%s" , flagOutdir , privateKeyPath )
142146 }
143147}
144148
0 commit comments