Skip to content

Add a config package to load application configuration using Viper with multi-format support (YAML, TOML, JSON) #25

Description

@akkahshh24

Description:
We can create a config package which will implement a LoadConfig() function to read the application configuration from multiple file formats (.yaml, .toml, .json) using the Viper package.

The configuration options can be unmarshaled into a Go struct AppConfig only once at the time of application startup and used to initialize other parts of the application like EspressoService.

Image

Benefits:

  1. Separate configuration reading logic from the business logic.
  2. Get rid of raw string literals like viper.GetString("s3.endpoint")
  3. Unmarshal into a well-defined Go struct and pass it around for constructing other objects.

I’d like to take this up and implement it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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