gotral

package module
v0.0.0-...-b5031bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 5 Imported by: 0

README

GoTral Go Report Card

Encrypted Golang Centralized Configuration management

Feature

  • E2E Encryption (via http/s)
  • Basic auth support
  • Multiple config file in single server
  • Easy to use, simple API and return as map[string]string
  • ....and more (/next update)

Setup & Install

Make sure you already have GoTral server up

For the library just like usual way

go get -u github.com/codenoid/gotral

Example Usage

package main

import (
	"fmt"

	"github.com/codenoid/gotral"
)

func main() {

	// super secret key
	secret := "somehardpw" // or just put string in there

	config, err := gotral.DirectLoad("http://localhost:6969/config?id=ecommerce.json", secret)
	if err != nil { fmt.Println(err) }
	if val, err := config.Get("mysql_username"); !err {
		fmt.Println(val)
	}

	// with basic auth support
	withOpt := gotral.GoTral{
		Url: "http://localhost:6969/config?id=ecommerce.json",
		Passphrase: "somehardpw",
		BasicAuth: true,
		Username: "guest",
		Password: "guest",
	}

	config, err = withOpt.LoadConfig()
	if err != nil { fmt.Println(err) }
	if val, err := config.Get("mysql_username"); !err {
		fmt.Println(val)
	}
}

Documentation

Overview

* * github.com/codenoid - Developer * code source : - https://github.com/codenoid/GoTral * - https://golang.org/pkg/net/http/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectLoad

func DirectLoad(url string, passphrase string) (confret, error)

DirectLoad : directly load config from given url and decrypt with given passphrase usually this function only called on app boot time

Types

type GoTral

type GoTral struct {
	Url        string
	Passphrase string
	BasicAuth  bool
	Username   string
	Password   string
}

GoTral : enabling uses of basic auth

func (GoTral) LoadConfig

func (r GoTral) LoadConfig() (confret, error)

LoadConfig : basic auth version support

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL