Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loading configuration from both YAML files and env vars #87

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Commits on Oct 31, 2024

  1. config: Allow matching errors returned from Validate()

    Any error returned from `Validate()` is propagated with
    `ErrInvalidConfiguration` attached, allowing `errors.Is()` checks on the
    returned errors to recognize both `ErrInvalidConfiguration` and the original
    errors returned from `Validate()`.
    lippserd committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    d24577e View commit details
    Browse the repository at this point in the history
  2. Introduce interface config#Flags

    This commit introduces the `Flags` interface, which provides methods related to
    access the configuration file path specified via command line flags. This
    interface will be implemented by flag structs containing a switch for the
    configuration file path and will serve as an argument for a future library
    function that combines loading configurations from YAML files and environment
    variables.
    lippserd committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    9d179a5 View commit details
    Browse the repository at this point in the history
  3. Support loading configurations from both YAML and env

    This commit adds the `config#Load` function to load configurations from both
    YAML files and environment variables. It handles scenarios where configurations
    are loaded exclusively from YAML, combined with environment variables, or
    entirely from environment variables if the YAML file is missing and no specific
    configuration file is provided via command line flags.
    lippserd committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    b1a510f View commit details
    Browse the repository at this point in the history
  4. Test config#Load

    lippserd committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    2ae27cf View commit details
    Browse the repository at this point in the history
  5. config: Don't use too many code refs in docs

    Else, they must be kept synchronized.
    lippserd committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    de37c59 View commit details
    Browse the repository at this point in the history
  6. config: Unify docs

    * Remove package docs, as `Load()` already provides a fairly complete example.
    * Add example usage to `FromEnv()`.
    * Add `TLS` to example usages.
    * Harmonize doc blocks.
    lippserd committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    f6b4896 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    069e535 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    79829da View commit details
    Browse the repository at this point in the history