martin-helmich/prometheus-nginxlog-exporter

View on GitHub
pkg/config/loader_hcl.go

Summary

Maintainability
A
0 mins
Test Coverage
package config

import (
    "io"

    "github.com/hashicorp/hcl"
)

func loadConfigFromHCLStream(config *Config, file io.Reader) error {
    buf, err := io.ReadAll(file)
    if err != nil {
        return err
    }

    hclText := string(buf)

    err = hcl.Decode(config, hclText)
    if err != nil {
        return err
    }

    return nil
}