Skip to content

Add functionality to fetch a slice of used environment variables in config #260

@saturn4er

Description

@saturn4er

In some cases, it's useful to be able to retrieve all the possible configurations of an application. To address this, it would be great to have a feature that allows fetching a slice of used environment variables in the config.

This feature will enable the ability to print a list of available configs for an application or to create a .env file template.

I propose adding the following struct, which represents an environment parameter:

type EnvParameter struct{
   EnvVariable   string
   DefaultValue  string
   Required      bool
   NotEmpty      bool
   Unset         bool
   ReadFromFile  bool
}

The implementation should provide a function to collect all the environment variables used in the config and return a slice of EnvParameter structs, containing the necessary details about each variable.

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