utils

package
v0.0.0-...-8abe587 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOGGER_MODE_DEBUG = "debug"
	LOGGER_MODE_PROD  = "prod"
)

Variables

This section is empty.

Functions

func ConvertHostInfoToJson

func ConvertHostInfoToJson() (string, error)

func GetHostInfoByteAndMap

func GetHostInfoByteAndMap() ([]byte, map[string]interface{}, error)

func YamlToJson

func YamlToJson(data []byte) ([]byte, error)

Types

type Config

type Config struct {
	Docker  Docker `yaml:"docker"`
	Mqtt    Mqtt   `yaml:"mqtt"`
	AppName string `yaml:"app_name"`
}

func ParseConfig

func ParseConfig(file string) *Config

type Docker

type Docker struct {
	// ImageWhitelist []string `yaml:"image_whitelist"`
	NetworkId      string `yaml:"network_id"`
	NetworkSubnet  string `yaml:"network_subnet"`
	NetworkGateway string `yaml:"network_gateway"`
}

type Logger

type Logger struct {
	Instance *zap.Logger
}

func (*Logger) Debug

func (log *Logger) Debug(msg string, fields ...zapcore.Field)

func (*Logger) Error

func (log *Logger) Error(msg string, fields ...zapcore.Field)

func (*Logger) Fatal

func (log *Logger) Fatal(msg string, fields ...zapcore.Field)

func (*Logger) Init

func (log *Logger) Init(mode string)

func (*Logger) Warn

func (log *Logger) Warn(msg string, fields ...zapcore.Field)

type Mqtt

type Mqtt struct {
	Broker               string `yaml:"broker"`    //url of the remote broker
	ClientId             string `yaml:"client_id"` //client id to connect to remote broker
	Username             string `yaml:"username"`  //username to connect to remote broker
	Password             string `yaml:"password"`  //password to connect to remote broker
	EnableHeartbeat      bool   `yaml:"enable_heartbeat"`
	HeartBeatInterval    int    `yaml:"heartbeat_interval"`
	BrokerPublishTopic   string `yaml:"broker_publish_topic"`
	BrokerSubscribeTopic string `yaml:"broker_subscribe_topic"`
}

Jump to

Keyboard shortcuts

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