Skip to content

Replace boolean parameters with options pattern (spaFallback, SetAllowPrivateIPs) #65

Description

@intel352

Problem

Two functions use ambiguous boolean parameters:

  • NewStaticFileServer(root string, spaFallback bool) — call sites read as NewStaticFileServer("/", true) with no context
  • SetAllowPrivateIPs(allow bool) — two booleans in one method

Fix Direction

Use the functional options pattern or separate methods:

  • NewStaticFileServer(root string, opts ...StaticFileServerOption) with WithSPAFallback() option
  • Replace SetAllowPrivateIPs(bool) with AllowPrivateIPs() / DisallowPrivateIPs() or an options struct

Context

See docs/DEFERRED_ISSUES.md — Code Smells section.

Activity

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

Metadata

Metadata

Labels

tech-debtCode quality, smells, and incomplete implementations

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions