config

package
v0.0.0-...-78d802f Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Driver   string `json:"driver"`
	Hostname string `json:"hostname"`
	Port     int    `json:"port"`
	Database int    `json:"database"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Config

type Config struct {
	Server   Server   `json:"server"`
	Database Database `json:"database"`
	Cache    Cache    `json:"cache"`
	JWT      JWT      `json:"jwt"`
}

func New

func New(configType, path string) *Config

New returns a new config object from an existing config and unmarshal from yaml or etcd

func (*Config) Backup

func (c *Config) Backup(backupPath string) error

Backup dumps the config to the location specified in yaml, use to dump from etcd too

func (*Config) GetCacheStore

func (c *Config) GetCacheStore() (store.CacheStore, error)

func (*Config) GetJWTService

func (c *Config) GetJWTService(cacheStore store.CacheStore) (*jwt.Service, error)

func (*Config) GetStore

func (c *Config) GetStore() (store.Store, error)

func (*Config) Restore

func (c *Config) Restore(backupPath string) error

Restore restores the config from the location, useful for writing yaml config to etcd

type Database

type Database struct {
	Driver   string `json:"driver"`
	Address  string `json:"address"`
	Port     int    `json:"port"`
	Database string `json:"database"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type JWT

type JWT struct {
	SigningKey string `json:"signing_ey"`
	RefreshKey string `json:"refresh_key"`
}

type Server

type Server struct {
	Address  string `json:"address"`
	Port     int    `json:"port"`
	Protocol string `json:"protocol""`
}

Jump to

Keyboard shortcuts

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