Skip to content

refactor: make examples accept addresses via CLI args and env vars#68

Merged
themantre merged 3 commits into
mainfrom
refactor-examples
Jul 3, 2026
Merged

refactor: make examples accept addresses via CLI args and env vars#68
themantre merged 3 commits into
mainfrom
refactor-examples

Conversation

@b00f

@b00f b00f commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Refactored all network-dependent examples to accept addresses via --address CLI option and environment variables, instead of hardcoded defaults.

Changes

  • 6 examples refactored: example_decode_block.py, example_jsonrpc_get_blockchain_info.py, example_jsonrpc_get_node_info.py, example_grpc_get_blockchain_info.py, example_grpc_get_node_info.py, example_zmq.py
  • Env vars: JSONRPC_ADDRESS, GRPC_ADDRESS, ZMQ_ADDRESS (priority: --address flag > env var, no hardcoded fallback)
  • Flattened structure: args parsed directly in __main__ and passed to work functions
  • Docstrings added with usage instructions
  • GitHub Actions: workflow now passes secrets as env vars and runs on a daily schedule (cron: 0 0 * * *)

Secrets to add in GitHub

  • EXAMPLES_JSONRPC_ADDRESS
  • EXAMPLES_GRPC_ADDRESS
  • EXAMPLES_ZMQ_ADDRESS

b00f added 3 commits July 3, 2026 17:20
- Add --address CLI option to all network-dependent examples
- Support JSONRPC_ADDRESS, GRPC_ADDRESS, ZMQ_ADDRESS env vars
- Remove hardcoded default addresses
- Flatten structure: parse args in __main__, pass addr directly
- Add docstrings with usage instructions
- Update GitHub Actions workflow to use secrets + daily schedule
@b00f b00f force-pushed the refactor-examples branch from 9ca4433 to 7475eb7 Compare July 3, 2026 09:33
@b00f b00f requested a review from themantre July 3, 2026 09:35
@themantre themantre merged commit 0de6e04 into main Jul 3, 2026
3 checks passed
@themantre themantre deleted the refactor-examples branch July 3, 2026 09:35
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.

2 participants