fablo icon indicating copy to clipboard operation
fablo copied to clipboard

feature- add CLI options to init command

Open Sanket-0510 opened this issue 9 months ago • 5 comments

Currently, executing fablo init initializes a small network configuration file. However, it would greatly enhance user experience if I could specify the number of organizations and peers directly from the command line interface (CLI). This would enable the generation of the configuration JSON file based on the inputs provided via CLI options.

Sanket-0510 avatar May 04 '24 14:05 Sanket-0510

hey @dzikowski any thoughts over this? I may raise PR to add this feature soon then.

Sanket-0510 avatar May 07 '24 13:05 Sanket-0510

I think it might be a bit tricky to implement, but you can start it if you want

dzikowski avatar May 07 '24 15:05 dzikowski

This one is indeed a tricky one cause its such a difficult task to identify where exactly the fablo-config.json is getting created. Turns out that, this line - https://github.com/hyperledger-labs/fablo/blob/cbd4ed0049d1b0876927cdbea80ee10531bbc7ba/fablo.sh#L122

initializes a temporary directory which has fablo as starting name and then some random string eg. fablo.34dfgrt and this is created at /tmp/fablo.xxxxxx. I understand this gets created but from where are we getting this sample config file already defined in this folder. basically it should initialise the temp folder but from where do am I getting this sample config file?

from console debugging I identified where the flow is going turn out that the schema for the sample-config file is getting modified here -https://github.com/hyperledger-labs/fablo/blob/cbd4ed0049d1b0876927cdbea80ee10531bbc7ba/src/init/index.ts but again changing log statements here had no effect on actual command run.

Sanket-0510 avatar May 22 '24 22:05 Sanket-0510

What I am guessing is that when I do init everything gets mounted to a docker container and that container and log statements and everything gets executed from there and that container gets destroyed after the execution, again I am not sure, I am guessing from this command - https://github.com/hyperledger-labs/fablo/blob/cbd4ed0049d1b0876927cdbea80ee10531bbc7ba/fablo.sh#L145C1-L150C9

Sanket-0510 avatar May 22 '24 22:05 Sanket-0510

@dzikowski @Hejwo you guys have done a lot of engineering and encapsulation while setting up this sample fablo-config.json :disappointed_relieved:

Sanket-0510 avatar May 22 '24 22:05 Sanket-0510