VictoriaMetrics/lib/promauth/util.go
2020-04-13 12:59:10 +03:00

25 lines
426 B
Go

package promauth
import (
"io/ioutil"
"path/filepath"
"strings"
"unicode"
)
func getFilepath(baseDir, path string) string {
if filepath.IsAbs(path) {
return path
}
return filepath.Join(baseDir, path)
}
func readPasswordFromFile(path string) (string, error) {
data, err := ioutil.ReadFile(path)
if err != nil {
return "", err
}
pass := strings.TrimRightFunc(string(data), unicode.IsSpace)
return pass, nil
}