Skip to content

minerva is remote config library using redis as configuration management

Notifications You must be signed in to change notification settings

AdhityaRamadhanus/minerva

Repository files navigation

minerva

Build Status

configuration management using redis

Installation | Usage | Todo | License

minerva is remote config library using redis as configuration management

Installation

  • go get github.com/AdhityaRamadhanus/minerva

Usage

  • See examples for more details
package main

import (
	"log"
	"os"
	"time"

	"github.com/AdhityaRamadhanus/minerva"
	redis "github.com/AdhityaRamadhanus/minerva/redis"
)

func main() {
    // Create your service provider, currently only redis is implemented
	redisService := redis.NewRedisService(&redis.Options{
		Addr: "localhost:6379",
		DB:   0,
	})

    minerva := minerva.New(redisService)
    // you can watch any change on the config by calling Watch function
	minerva.Watch()
	for {
		if minerva.Get("is-maintenance") == "true" {
			log.Println("Server is in maintenance")
			minerva.Close()
			os.Exit(0)
		}
		log.Println("Serving Request")
		time.Sleep(1 * time.Second)
	}
}

Todo

  • Dynamic prefix key
  • Bootstrap config value
  • CLI to manage configuration
  • More robust and proper error handling
  • Add debouncing in getting key value on parsing key event
  • Add test
  • Add CI

License

MIT © [Adhitya Ramadhanus]

About

minerva is remote config library using redis as configuration management

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published