mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-29 23:30:04 +01:00
25 lines
426 B
Go
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
|
||
|
}
|