Skip to content

Allow config.Save to clear explicitly reset configuration values #6

Description

@Luqueee

Problem

In internal/config/config.go:257-333, updateMapping only writes non-zero fields. Existing values therefore cannot be cleared or reset through a Save round-trip.

Examples include:

  • ports and port lists remain after setting them to empty.
  • admin_addr remains after disabling the admin API.
  • insecure: true remains after setting it back to false.
  • Empty string and zero-valued settings remain stale in the YAML.

This can make mole config edit or other config mutations disagree with the effective runtime configuration.

Acceptance criteria

  • Define an explicit distinction between “field not requested” and “field requested with its zero value”.
  • Make clearing ports, admin_addr, insecure, and other resettable fields deterministic.
  • Preserve comments, key order, and user-only YAML keys.
  • Add tests for clearing booleans, strings, slices, and numeric values.
  • Keep the documented precedence between defaults, YAML, and CLI flags.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions