Skip to content

Support type field map during pass through env variable #103

Description

@thehighestmath

Problem

Confita doesn't support map types when loading from environment variables:

type Config struct {
    Settings map[string][]int `config:"settings"`
}

Current error

Error: failed to parse config: field type 'map' not supported

Proposal

Add support for maps by parsing JSON from env variables:

export SETTINGS='{"key1":[1,2,3],"key2":[4,5,6]}'
export ACT_RECEIPT_UZ_ALLOWED_INVOICE_PAYMENT_METHODS_BY_SERVICES='{7: [1101], 37: [1101], 671: [1101]}'

Benefits

  • More flexible configuration options
  • Support for complex nested structures
  • Consistency with other config libraries (viper, envconfig)

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions