config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

Config

ConsulKV

package main

import (
    "github.com/axolotlteam/thunder/config"
)

func main() {
    v , err := config.ConsulKV("consulhost" , "key" , "ftype{json/yaml}")
    if err != nil {
        log.Fatal(err)
    }

    v.GetString("xxx.xxx")


    x := config.Database{}

    // maping to struct
    err := viper.Unmarshal(&x)

}

Documentation

Index

Constants

View Source
const (
	YAML = "yaml"
	JSON = "json"
)

Variables

This section is empty.

Functions

func ConsulByClient added in v0.18.0

func ConsulByClient(client *api.Client, key string, ftype string) (*viper.Viper, error)

ConsulByClient -

func ConsulKV

func ConsulKV(host, key string, ftype string) (*viper.Viper, error)

ConsulKV -

Types

type Consul added in v0.18.3

type Consul struct {
	Host string `json:"host" yaml:"host"`
	Acl  string `json:"acl" yaml:"acl"`
}

type Database

type Database struct {
	Host       string `json:"host" yaml:"host"`
	User       string `json:"user" yaml:"user"`
	Password   string `json:"password" yaml:"password"`
	Database   string `json:"database" yaml:"database"`
	Collection string `json:"collection" yaml:"collection"`
	SSL        bool   `json:"ssl" yaml:"ssl"`
	AppName    string `json:"appname" yaml:"appname"`
	PoolSize   uint64 `json:"poolsize" yaml:"poolsize"`
	ReplicaSet string `json:"replicaset" yaml:"replicaset"`
}

Database -

type Logger

type Logger struct {
	Level   string `json:"level" yaml:"level"`
	Webhook string `json:"webhook" yaml:"webhook"`
}

Logger -

type Nats added in v0.14.0

type Nats struct {
	Host     string `json:"host" yaml:"host"`
	User     string `json:"user" yaml:"user"`
	Password string `json:"password" yaml:"password"`
	Name     string `json:"name" yaml:"name"`
}

Nats -

Jump to

Keyboard shortcuts

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