config

package
v0.0.0-...-19cc336 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Confs = Config{}

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug    bool     // if true we run on debug mode
	Service  Service  `yaml:"service"`
	Postgres Database `yaml:"database"`
}

func (*Config) GetDebug

func (g *Config) GetDebug() bool

func (*Config) Load

func (g *Config) Load(path string) error

Load returns configs

func (*Config) Set

func (g *Config) Set(key string, query []byte) error

Set method you can set new key in switch for manage config with config server

func (*Config) SetDebug

func (g *Config) SetDebug(debug bool)

type ConfigInterface

type ConfigInterface interface {
	Set(key string, query []byte) error
	SetDebug(bool)
	GetDebug() bool
	Load(path string) error
}

type Database

type Database struct {
	Username string `yaml:"postgres.username"`
	Password string `yaml:"postgres.password"`
	Host     string `yaml:"postgres.host"`
	Port     string `yaml:"postgres.port"`
	DB       string `yaml:"postgres.db"`
	SslMode  string `yaml:"postgres.sslmode"`
	TimeZone string `yaml:"postgres.timezone"`
}

type Service

type Service struct {
	Name    string `yaml:"service.name"`
	ID      uint32 `yaml:"service.id"`
	BaseURL string `yaml:"service.baseURL"`
	HTTP    struct {
		Host           string `yaml:"http.host"`
		Port           string `yaml:"http.port"`
		RequestTimeout uint   `yaml:"http.requestTimeout"`
		AllowOrigin    string `yaml:"http.allowOrigin"`
	}
	Token struct {
		Password   string `yaml:"token.password"`
		Expiration uint   `yaml:"token.expiration"`
	}
}

Jump to

Keyboard shortcuts

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