hyperledger / hyperledger/fabric-x

bug(fxconfig/cli): info --format=env drops zero-value configuration fields

Open
#231 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
64
Forks
80
Avg merge
1d 22h
Merged PRs (30d)
15

Description

# fxconfig Issue: Zero Values Omitted in Env Output

## Description
The `fxconfig info --format=env` command drops configuration fields with zero values (e.g., `false`, `0s`, `""`).

Currently, in `cli/v1/info.go` (lines 73-87), the `toEnv()` function marshals the `Config` struct to YAML then unmarshals to `map[string]any`. The `yaml:"...,omitempty"` tags omit zero-value fields from YAML, excluding them from env output.

## Expected Behavior
The `info` command should display **all** effective values—including defaults and zeros—for full configuration verification.

## Actual Behavior
Zero-value fields like `enabled: false`, `connectionTimeout: 0s`, and empty strings are silently omitted from `--format=env` output, creating incomplete representations.

## Proposed Solution
Replace YAML round-trip in `toEnv()` with reflection-based struct-to-env converter that includes all exported fields, using `mapstructure` tags for naming. Add comprehensive tests for zero-value export verification.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.