factory

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WebuiDefaultTLSKeyLogPath  = "./log/webuisslkey.log"
	WebuiDefaultCertPemPath    = "./cert/webui.pem"
	WebuiDefaultPrivateKeyPath = "./cert/webui.key"
	WebuiDefaultConfigPath     = "./config/webuicfg.yaml"
)

Variables

This section is empty.

Functions

func InitConfigFactory

func InitConfigFactory(f string, cfg *Config) error

TODO: Support configuration update from REST api

Types

type BillingServer added in v1.3.1

type BillingServer struct {
	Enable     bool   `yaml:"enable,omitempty" valid:"required,type(bool)"`
	HostIPv4   string `yaml:"hostIPv4,omitempty" valid:"required,host"`
	Port       int    `yaml:"port,omitempty" valid:"optional,port"`
	ListenPort int    `yaml:"listenPort,omitempty" valid:"required,port"`
	Tls        *Tls   `yaml:"tls,omitempty" valid:"optional"`
}

type Config

type Config struct {
	Info          *Info          `yaml:"info" valid:"required"`
	Configuration *Configuration `yaml:"configuration" valid:"required"`
	Logger        *Logger        `yaml:"logger" valid:"required"`
	sync.RWMutex
}
var WebuiConfig *Config

func ReadConfig added in v1.3.1

func ReadConfig(cfgPath string) (*Config, error)

func (*Config) GetLogEnable added in v1.3.1

func (c *Config) GetLogEnable() bool

func (*Config) GetLogLevel added in v1.3.1

func (c *Config) GetLogLevel() string

func (*Config) GetLogReportCaller added in v1.3.1

func (c *Config) GetLogReportCaller() bool

func (*Config) SetLogEnable added in v1.3.1

func (c *Config) SetLogEnable(enable bool)

func (*Config) SetLogLevel added in v1.3.1

func (c *Config) SetLogLevel(level string)

func (*Config) SetLogReportCaller added in v1.3.1

func (c *Config) SetLogReportCaller(reportCaller bool)

func (*Config) Validate added in v1.3.1

func (c *Config) Validate() (bool, error)

type Configuration

type Configuration struct {
	WebServer     *WebServer     `yaml:"webServer,omitempty" valid:"optional"`
	Mongodb       *Mongodb       `yaml:"mongodb" valid:"required"`
	NrfUri        string         `yaml:"nrfUri" valid:"required"`
	BillingServer *BillingServer `yaml:"billingServer,omitempty" valid:"required"`
}

type Info

type Info struct {
	Version     string `yaml:"version,omitempty" valid:"required,in(1.0.2)"`
	Description string `yaml:"description,omitempty" valid:"type(string)"`
}

type Logger added in v1.3.1

type Logger struct {
	Enable       bool   `yaml:"enable" valid:"type(bool)"`
	Level        string `yaml:"level" valid:"required,in(trace|debug|info|warn|error|fatal|panic)"`
	ReportCaller bool   `yaml:"reportCaller" valid:"type(bool)"`
}

type Mongodb

type Mongodb struct {
	Name string `yaml:"name" valid:"required"`
	Url  string `yaml:"url"  valid:"required"`
}

type Tls added in v1.3.1

type Tls struct {
	Pem string `yaml:"pem,omitempty" valid:"type(string),minstringlength(1),required"`
	Key string `yaml:"key,omitempty" valid:"type(string),minstringlength(1),required"`
}

type WebServer

type WebServer struct {
	Scheme string `yaml:"scheme" valid:"required"`
	IP     string `yaml:"ipv4Address,omitempty"`
	PORT   string `yaml:"port" valid:"required"`
}

Jump to

Keyboard shortcuts

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