mirror of
https://github.com/eko/pihole-exporter.git
synced 2024-11-23 11:26:30 +01:00
Print go version at startup
This commit is contained in:
parent
c13fb48352
commit
55dca92b79
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
vendor
|
vendor
|
||||||
bin
|
bin
|
||||||
tmp
|
tmp
|
||||||
|
|
||||||
.vscode
|
.vscode
|
||||||
report.xml
|
report.xml
|
||||||
debug
|
debug
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ func (c *Config) String() string {
|
|||||||
return fmt.Sprintf("<Config@%X %s>", &c, strings.Join(buffer, ", "))
|
return fmt.Sprintf("<Config@%X %s>", &c, strings.Join(buffer, ", "))
|
||||||
}
|
}
|
||||||
|
|
||||||
//Validate check if the config is valid
|
// Validate check if the config is valid
|
||||||
func (c Config) Validate() error {
|
func (c Config) Validate() error {
|
||||||
if c.PIHoleProtocol != "http" && c.PIHoleProtocol != "https" {
|
if c.PIHoleProtocol != "http" && c.PIHoleProtocol != "https" {
|
||||||
return fmt.Errorf("protocol %s is invalid. Must be http or https", c.PIHoleProtocol)
|
return fmt.Errorf("protocol %s is invalid. Must be http or https", c.PIHoleProtocol)
|
||||||
@ -175,12 +176,12 @@ func (c Config) hostnameURL() string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
//PIHoleStatsURL returns the stats url
|
// PIHoleStatsURL returns the stats url
|
||||||
func (c Config) PIHoleStatsURL() string {
|
func (c Config) PIHoleStatsURL() string {
|
||||||
return c.hostnameURL() + "/admin/api.php?summaryRaw&overTimeData&topItems&recentItems&getQueryTypes&getForwardDestinations&getQuerySources&jsonForceObject"
|
return c.hostnameURL() + "/admin/api.php?summaryRaw&overTimeData&topItems&recentItems&getQueryTypes&getForwardDestinations&getQuerySources&jsonForceObject"
|
||||||
}
|
}
|
||||||
|
|
||||||
//PIHoleLoginURL returns the login url
|
// PIHoleLoginURL returns the login url
|
||||||
func (c Config) PIHoleLoginURL() string {
|
func (c Config) PIHoleLoginURL() string {
|
||||||
return c.hostnameURL() + "/admin/index.php?login"
|
return c.hostnameURL() + "/admin/index.php?login"
|
||||||
}
|
}
|
||||||
@ -190,6 +191,7 @@ func (c EnvConfig) show() {
|
|||||||
log.Println("------------------------------------")
|
log.Println("------------------------------------")
|
||||||
log.Println("- PI-Hole exporter configuration -")
|
log.Println("- PI-Hole exporter configuration -")
|
||||||
log.Println("------------------------------------")
|
log.Println("------------------------------------")
|
||||||
|
log.Printf("Go version: %s", runtime.Version())
|
||||||
for i := 0; i < val.NumField(); i++ {
|
for i := 0; i < val.NumField(); i++ {
|
||||||
valueField := val.Field(i)
|
valueField := val.Field(i)
|
||||||
typeField := val.Type().Field(i)
|
typeField := val.Type().Field(i)
|
||||||
|
Loading…
Reference in New Issue
Block a user