Yet another config package

cfg

Yet another config package

Features

  • Read from file
  • Read from environment variable
  • Hot reload of the file

Usage

package main

import (
	"context"
	"fmt"

	"github.com/infiniteloopcloud/cfg"
)

var config cfg.Config

func main() {
	var err error
	config, err = cfg.New(cfg.Opts{
		Path:      "./config.json",
		HotReload: true,
		Infof: func(ctx context.Context, format string, args ...interface{}) {
			fmt.Printf(format+"\n", args...)
		},
	})
	if err != nil {
		// TODO err
    }

	// First it reads from the ./config.json (it's a map[string]string under the hood)
	// After it reads with os.Getenv
	config.Get("something")
}
Owner
infinite loop
Company working on financial solutions.
infinite loop
Similar Resources

Little Go tool to infer an uncrustify config file from an expected format

uncrustify-infer Little Go tool to infer an uncrustify config file from an expected format Install This tool relies on an uncrustify executable, you m

Oct 8, 2021

Ewwwwwww - Yuck Config

Ewwwwwww - Yuck Config

Eww Config What is it Using Eww Widgets to create a replacement for my bumblebee-status bars in i3 Window Manager. Eww allows you to create widgets an

Dec 29, 2022

A lightweight config center written by golang.

A lightweight config center written by golang.

Jan 21, 2022

Project my config into your prebuild

Projector A simple key value store per path. Building From Source git clone [email protected]:ThePrimeagen/projector.git cd projector # Install it where

Jun 23, 2022

Simple Config Format for Golang.

IndentText Simple Configuration Format that tries to be easy to use and understand at a glance. Unlike other formats, IndentText does not have any typ

Nov 26, 2021

Viper wrapper with config inheritance and key generation

piper - Simple Wrapper For Viper Single Source of Truth Generated Key Structs, No Typo Config Inheritance Multiple Config Strategies Support Cache For

Sep 26, 2022

A viewer for creating a one-page app that renders the config file as a webpage.

Matterbridge Config Viewer A viewer for creating a one-page app that renders the config file as a webpage. Local Development npm install npm run-scrip

Jul 9, 2021

App that generates a Matterbridge config file based on channel names.

Matterbridge Auto-Config App that generates a Matterbridge config file based on channel names. This remote configuration file* is generated based on s

Oct 15, 2022

Config files for my GitHub profile.

hcltm Threat Modeling with HCL Overview There are many different ways in which a threat model can be documented. From a simple text file, to more in-d

Dec 7, 2021
Related tags
⚙️ Dead Simple Config Management, load and persist config without having to think about where and how.

Configo Dead Simple Config Management, load and persist config without having to think about where and how. Install go get github.com/UltiRequiem/conf

Apr 6, 2022
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
Simple, useful and opinionated config loader.

aconfig Simple, useful and opinionated config loader. Rationale There are many solutions regarding configuration loading in Go. I was looking for a si

Dec 26, 2022
go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config

HOCON (Human-Optimized Config Object Notation) Configuration library for working with the Lightbend's HOCON format. HOCON is a human-friendly JSON sup

Dec 3, 2022
Composable, observable and performant config handling for Go for the distributed processing era

Konfig Composable, observable and performant config handling for Go. Written for larger distributed systems where you may have plenty of configuration

Dec 11, 2022
🔥🔥 🌈 Golang configuration,use to Viper reading from remote Nacos config systems. Viper remote for Naocs.

Viper remote for Nacos Golang configuration,use to Viper reading from remote Nacos config systems. Viper remote for Naocs. runtime_viper := viper.New(

Dec 6, 2022
create a bootable disk image from Docker image or a yaml config

docker2boot docker2boot creates a bootable disk from either a Docker image or a config yaml file Features status dns Y cloud-init Y network Y ssh TODO

Oct 30, 2022
Nacos is a service config & discovery.

Kratos Nacos example sc := []constant.ServerConfig{ *constant.NewServerConfig("127.0.0.1", 8848), } cc := &constant.ClientConfig{ NamespaceId:

Oct 28, 2021
Sidecar to watch a config folder and reload a process when it changes

A small (3MB uncompressed docker image), efficient (via inotify) sidecar to trigger application reloads when configuration changes.

Dec 29, 2022