parser for configuration files

config-loader

config-loader supports to load config files and convert to map values.

Supported format

  • json

Usage

import (
	"fmt"

	"github.com/tharun208/config-loader/pkg/config"
)

func main() {
	// Initialize config loader
	config := config.NewConfig()

	// Load configuration files

	err := config.LoadFiles("fixtures/valid.json")
	// config.LoadFiles("fixtures/valid.json", "testdata/valid_local.json")

	if err != nil {
		panic(err)
	}

	// GetValue method returns pretty version of return value
	val := config.GetConfigValueAsString("cache")

	fmt.Printf("%v\n", val)

	val = config.GetConfigValueAsString("environment")

	fmt.Printf("%v\n", val)

	// GetConfigValue returns concrete go type value
	value := config.GetConfigValue("database.port")

	fmt.Printf("%v\n", value)
}

Running config-loader on local machine

You can run config-loader locally by running:

make run

Running config-loader on local machine using docker image

Build the Image locally using:

docker build -t config-loader .

Run the image using:

docker run -it config-loader
Similar Resources

ini parser for golang

ini parser for golang

INI Parser & Write Library ini parser and write library for Golang,easy-use,fast Features Can be read by []byte Can be read by file Supports file moni

Dec 3, 2022

A simple INI file parser and builder.

ini A simple INI file parser and builder. What Read INI files, or build them section by section. Datatypes are kept very simple. The main fuctions are

Nov 20, 2021

πŸ”ŽπŸͺ² Malleable C2 profiles parser and assembler written in golang

goMalleable πŸ”Ž πŸͺ² Malleable C2 profiles parser and assembler written in golang Table of Contents Introduction Installation Usage Examples Introduction

Oct 24, 2022

✨Clean and minimalistic environment configuration reader for Golang

Clean Env Minimalistic configuration reader Overview This is a simple configuration reading tool. It just does the following: reads and parses configu

Jan 8, 2023

12 factor configuration as a typesafe struct in as little as two function calls

Config Manage your application config as a typesafe struct in as little as two function calls. type MyConfig struct { DatabaseUrl string `config:"DAT

Dec 13, 2022

JSON or YAML configuration wrapper with convenient access methods.

Config Package config provides convenient access methods to configuration stored as JSON or YAML. This is a fork of the original version. This version

Dec 16, 2022

Configure is a Go package that gives you easy configuration of your project through redundancy

Configure Configure is a Go package that gives you easy configuration of your project through redundancy. It has an API inspired by negroni and the fl

Sep 26, 2022

An opinionated configuration loading framework for Containerized and Cloud-Native applications.

An opinionated configuration loading framework for Containerized and Cloud-Native applications.

Opinionated configuration loading framework for Containerized and 12-Factor compliant applications. Read configurations from Environment Variables, an

Dec 16, 2022

Load configuration in cascade from multiple backends into a struct

Load configuration in cascade from multiple backends into a struct

Confita is a library that loads configuration from multiple backends and stores it in a struct. Supported backends Environment variables JSON files Ya

Jan 1, 2023
Go-config - Config parser for go that supports environment vars and multiple yaml files

go-multiconfig This package is able to parse yaml config files. It supports gett

Jun 23, 2022
πŸ›  A configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP
πŸ›  A configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP

config A small configuration library for Go that parses environment variables, JSON files, and reloads automatically on SIGHUP. Example func main() {

Dec 11, 2022
A golang package for parsing ini-style configuration files

Mini Mini is a simple ini configuration file parser. The ini syntax supported includes: The standard name=value Comments on new lines starting with #

Jan 7, 2023
Manage local application configuration files using templates and data from etcd or consul

confd confd is a lightweight configuration management tool focused on: keeping local configuration files up-to-date using data stored in etcd, consul,

Dec 27, 2022
Generate initial configuration files for Go.

Generate initial configuration files for Go.

Mar 26, 2022
Golang library for reading properties from configuration files in JSON and YAML format or from environment variables.

go-config Golang library for reading properties from configuration files in JSON and YAML format or from environment variables. Usage Create config in

Aug 22, 2022
Tinyini - Bare-bones Go library for reading INI-like configuration files

tinyini tinyini is a minimalistic library for parsing INI-like configuration files. example configuration file globalkey = globalvalue [section] key

Jan 10, 2022
Jul 4, 2022
TOML parser for Golang with reflection.

THIS PROJECT IS UNMAINTAINED The last commit to this repo before writing this message occurred over two years ago. While it was never my intention to

Jan 6, 2023
TOML parser and encoder library for Golang

TOML parser and encoder library for Golang TOML parser and encoder library for Golang. This library is compatible with TOML version v0.4.0. Installati

Oct 11, 2022