grafana/pkg/tsdb/grafana-postgresql-datasource/standalone/main.go

23 lines
751 B
Go
Raw Normal View History

2025-10-02 20:12:47 +08:00
package main
import (
"os"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"github.com/grafana/grafana/pkg/setting"
postgres "github.com/grafana/grafana/pkg/tsdb/grafana-postgresql-datasource"
)
func main() {
// No need to pass logger name, it will be set by the plugin SDK
logger := backend.NewLoggerWith()
// TODO: get rid of setting.NewCfg() once PostgresDSUsePGX is removed
2025-10-02 20:12:47 +08:00
cfg := setting.NewCfg()
if err := datasource.Manage("grafana-postgresql-datasource", postgres.NewInstanceSettings(logger, true, cfg.DataPath), datasource.ManageOpts{}); err != nil {
2025-10-02 20:12:47 +08:00
log.DefaultLogger.Error(err.Error())
os.Exit(1)
}
}