Skip to content

feat(cli): add support for dynamic configuration overrides in init command #444`#732

Open
HarK-github wants to merge 11 commits into
hyperledger-labs:mainfrom
HarK-github:issue444
Open

feat(cli): add support for dynamic configuration overrides in init command #444`#732
HarK-github wants to merge 11 commits into
hyperledger-labs:mainfrom
HarK-github:issue444

Conversation

@HarK-github
Copy link
Copy Markdown
Contributor

@HarK-github HarK-github commented Apr 22, 2026

Add Support for Dynamic Configuration Overrides in fablo init

This PR introduces the ability to override any property in the default fablo-config.json directly from the CLI during fablo init using the --set flag.

1. New --set Flag

  • Users can now override configuration values using --set key=value syntax
  • Supports multiple --set flags in a single command
  • Example: fablo init --set global.fabricVersion=2.5.0 --set global.tls=false

2. Smart Type Casting

The parser automatically detects and converts values to appropriate types:

  • Booleans: true/false → boolean type
  • Numbers: 5, 3.14 → number type
  • JSON: {"key":"value"}, [1,2,3] → object/array type
  • Strings: All other values → string type

3. Nested Path Support

  • Supports dot notation for nested objects: global.monitoring.loglevel=debug
  • Supports array indexing: orgs[0].peer.db=CouchDb
  • Auto-creates non-existent nested paths

4. Backward Compatibility

  • Preserves existing node, dev, ccaas, gateway, rest positional arguments
  • Existing workflows continue to work without changes
  • Command signature unchanged

5. E2E Test Coverage

Added comprehensive test coverage for:

  • Numeric string coercion (ensures numbers, not strings)
  • Non-existent nested path creation
  • Multiple simultaneous overrides with mixed types
  • Boolean, string, and array overrides

Usage Examples:

# Single override
fablo init --set global.fabricVersion=2.5.0

# Multiple overrides
fablo init --set global.tls=false --set orgs[0].peer.db=CouchDb

# With positional arguments
fablo init node --set global.fabricVersion=3.0.0 --set orgs[1].peer.instances=5

# Complex nested paths
fablo init --set global.monitoring.loglevel=debug --set channels[0].name=my-channel2

dependabot Bot and others added 6 commits April 17, 2026 05:11
Bumps [protobufjs](https://github.com/protobufjs/protobuf.js) from 7.5.0 to 7.5.5.
- [Release notes](https://github.com/protobufjs/protobuf.js/releases)
- [Changelog](https://github.com/protobufjs/protobuf.js/blob/master/CHANGELOG.md)
- [Commits](protobufjs/protobuf.js@protobufjs-v7.5.0...protobufjs-v7.5.5)

---
updated-dependencies:
- dependency-name: protobufjs
  dependency-version: 7.5.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…mmand

Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
@OsamaRab3
Copy link
Copy Markdown
Contributor

I ran it locally, but it doesn’t work as expected. When running:
./bin/run.mjs init --orgs[0].peer.instances=5
I get the following error:
zsh: no matches found: --orgs[0].peer.instances=5 the same error with ./bin/run.mjs init --channels[0].name=my-channel2 it only work with ./bin/run.mjs init --global.tls=true  Also, I’m not a big fan of the current implementation approach it feels a bit hard to follow and might benefit from simplification or clearer structure.

@HarK-github
Copy link
Copy Markdown
Contributor Author

HarK-github commented Apr 24, 2026

@OsamaRab3 I have made some changes. Try using set flag . ex :/fablo.sh init --set global.fabricVersion=2.5.0 --set global.tls=false

Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
Signed-off-by: Harshit Kandpal <kandpalhar@gmail.com>
@HarK-github
Copy link
Copy Markdown
Contributor Author

@OsamaRab3 did it work?

@HarK-github
Copy link
Copy Markdown
Contributor Author

@OsamaRab3 can you have a look please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants