Skip to content

feat: Add LoadFromConfiguration for appsettings.json support #410

@JusterZhu

Description

@JusterZhu

Summary

The refactoring plan specifies a LoadFromConfiguration(IConfiguration config) method on GeneralUpdateBootstrap for loading settings from appsettings.json, environment variables, and command-line args. This is not yet implemented.

Expected API

// Load from IConfiguration (Microsoft.Extensions.Configuration)
new GeneralUpdateBootstrap()
    .LoadFromConfiguration(builder.Configuration)
    .LaunchAsync();

// Load from appsettings.json section
new GeneralUpdateBootstrap()
    .LoadFromConfiguration(config.GetSection("GeneralUpdate"))
    .LaunchAsync();

Expected Behavior

  1. Map IConfiguration keys to UpdateOptions and Configinfo fields
  2. Priority: code .Option() calls override configuration values
  3. Support standard appsettings.json bindings:
    • GeneralUpdate:AppType
    • GeneralUpdate:UpdateUrl
    • GeneralUpdate:AppSecretKey
    • GeneralUpdate:DiffMode
    • GeneralUpdate:Silent, etc.
  4. Chainable: .LoadFromConfiguration(config).Option(UpdateOptions.Silent, true) — code overrides config

Benefits

  • Zero-code configuration for common scenarios
  • Standard .NET configuration pattern
  • Enables environment-specific configs (appsettings.Development.json, appsettings.Production.json)

Ref

Refactoring plan v2: Section 2.3, "LoadFromConfiguration"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions