Remove env variable usage
This commit is contained in:
@@ -2,9 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/datasource"
|
"github.com/alexanderzobnin/grafana-zabbix/pkg/datasource"
|
||||||
|
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend/resource/httpadapter"
|
"github.com/grafana/grafana-plugin-sdk-go/backend/resource/httpadapter"
|
||||||
@@ -33,20 +33,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Init(logger log.Logger, mux *http.ServeMux) *datasource.ZabbixDatasource {
|
func Init(logger log.Logger, mux *http.ServeMux) *datasource.ZabbixDatasource {
|
||||||
variableName := "GFX_ZABBIX_DATA_PATH"
|
|
||||||
path, exist := os.LookupEnv(variableName)
|
|
||||||
if !exist {
|
|
||||||
logger.Debug("Could not read environment variable", variableName)
|
|
||||||
} else {
|
|
||||||
logger.Debug("Environment variable for storage found", "variable", variableName, "value", path)
|
|
||||||
}
|
|
||||||
|
|
||||||
ds := datasource.NewZabbixDatasource()
|
ds := datasource.NewZabbixDatasource()
|
||||||
|
|
||||||
mux.HandleFunc("/", ds.RootHandler)
|
mux.HandleFunc("/", ds.RootHandler)
|
||||||
mux.HandleFunc("/zabbix-api", ds.ZabbixAPIHandler)
|
mux.HandleFunc("/zabbix-api", ds.ZabbixAPIHandler)
|
||||||
mux.HandleFunc("/db-connection-post", ds.DBConnectionPostProcessingHandler)
|
mux.HandleFunc("/db-connection-post", ds.DBConnectionPostProcessingHandler)
|
||||||
// mux.Handle("/scenarios", getScenariosHandler(logger))
|
|
||||||
|
|
||||||
return ds
|
return ds
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user