configlib

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Types

type BasicConfiger

type BasicConfiger struct {
	// contains filtered or unexported fields
}

func (*BasicConfiger) GetApplicationID

func (c *BasicConfiger) GetApplicationID() int

func (*BasicConfiger) GetBool

func (c *BasicConfiger) GetBool(path string) bool

func (*BasicConfiger) GetEnvironment

func (c *BasicConfiger) GetEnvironment() string

func (*BasicConfiger) GetFloat

func (c *BasicConfiger) GetFloat(path string) float64

func (*BasicConfiger) GetInt

func (c *BasicConfiger) GetInt(path string) int64

func (*BasicConfiger) GetObject

func (c *BasicConfiger) GetObject(path string) interface{}

func (*BasicConfiger) GetService

func (c *BasicConfiger) GetService(service string) Service

func (*BasicConfiger) GetSlice

func (c *BasicConfiger) GetSlice(path string) []interface{}

func (*BasicConfiger) GetString

func (c *BasicConfiger) GetString(path string) string

func (*BasicConfiger) GetWebserver

func (c *BasicConfiger) GetWebserver() Webserver

type Config

type Config struct {
	ID          int                `json:"Id"`
	Environment string             `json:"Environment"`
	Webserver   Webserver          `json:"Webserver"`
	Services    map[string]Service `json:"Services"`
}

type Configer

type Configer interface {
	GetEnvironment() string
	GetApplicationID() int
	GetWebserver() Webserver
	GetService(service string) Service
	GetString(path string) string
	GetFloat(path string) float64
	GetInt(path string) int64
	GetBool(path string) bool
	GetObject(path string) interface{}
	GetSlice(path string) []interface{}
}

func ReadConfig

func ReadConfig() Configer

type Service

type Service struct {
	ID   int    `json:"Id"`
	Host string `json:"Host"`
}

type Webserver

type Webserver struct {
	Host         string   `json:"Host"`
	Port         int      `json:"Port"`
	ReadTimeout  int      `json:"ReadTimeout"`
	WriteTimeout int      `json:"WriteTimeout"`
	Cors         []string `json:"Cors"`
}

Jump to

Keyboard shortcuts

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