config

package
v0.0.0-...-8549e42 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EnvFile = ".env"
)

Functions

func InitConfig

func InitConfig(file string, config *AppConfig) api_error.ApiErr

Types

type AppConfig

type AppConfig struct {
	Server struct {
		Host                 string `envconfig:"SERVER_HOST"`
		Port                 string `envconfig:"SERVER_PORT" default:"8080"`
		TlsPort              string `envconfig:"SERVER_TLS_PORT" default:"8443"`
		GracefulShutdownTime int    `envconfig:"GRACEFUL_SHUTDOWN_TIME" default:"10"`
		UseTls               bool   `envconfig:"USE_TLS" default:"false"`
		CertFile             string `envconfig:"CERT_FILE" default:"./cert/cert.pem"`
		KeyFile              string `envconfig:"KEY_FILE" default:"./cert/cert.key"`
	}
	Gin struct {
		Mode         string `envconfig:"GIN_MODE" default:"release"`
		TemplatePath string `envconfig:"TEMPLATE_PATH" default:"./templates/"`
	}
	ShellyEM3 struct {
		Host         string `envconfig:"SHELLY_HOST"`
		User         string `envconfig:"SHELLY_USER"`
		Password     string `envconfig:"SHELLY_PASS"`
		UseBasicAuth bool   `envconfig:"SHELLY_USE_BASIC_AUTH" default:"false"`
		IntervalSec  int    `envconfig:"SHELLY_INTERVAL_SEC" default:"1"`
	}
	Metrics struct {
		VoltageGauge       prometheus.GaugeVec
		CurrentGauge       prometheus.GaugeVec
		ActivePowerGauge   prometheus.GaugeVec
		ApparentPowerGauge prometheus.GaugeVec
		PowerFactorGauge   prometheus.GaugeVec
		FrequencyGauge     prometheus.GaugeVec
	}
	RunTime struct {
		Router            *gin.Engine
		ListenAddr        string
		StartDate         time.Time
		RunShellyPoll     bool
		ShellyCurrentData domain.ShellyData
	}
}

Jump to

Keyboard shortcuts

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