Skip to content

Make DerivedState from Configs #113

@mlajkim

Description

@mlajkim

Current SIA v3.2 turns on/off based on given configurations, but it has the following probles:

  • Easy to make mistakes for developers
    • Let's say the following is the correct setting that makes SIA to read local instance cert
    • this.config.ProviderService === "" && this.config.CertFile === "" && this.config.KeyFile === ""
    • Developers might forget to include this.config.CertFile === "" && this.config.KeyFile === "" and only include this.config.ProviderService === ""
      • Actually happened and fixed in 27d3522
  • Hard to read
    • The following code is so vague and has no meaning.
    • this.config.ProviderService === "" && this.config.CertFile === "" && this.config.KeyFile === ""
    • if we can have a DerivedState that holds such combination, it would be much easier to read
DerivedState := func() {
  if this.config.ProviderService != "" {
    return "identityd"
  }
  if config.CertFile === "" &&config.KeyFile === ""  {
    return "readLocalFile"
  }
  return "inactive"
}()

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorChanges without functional changes, or api changes)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions