feat(shoutrrr): fix notification url files and tests

This commit is contained in:
p1ksel 2020-06-11 18:37:30 +02:00
parent 624e2a744a
commit e2b963e2aa
2 changed files with 31 additions and 5 deletions

View file

@ -390,16 +390,14 @@ func GetSecretsFromFiles(rootCmd *cobra.Command) {
// getSecretFromFile will check if the flag contains a reference to a file; if it does, replaces the value of the flag with the contents of the file.
func getSecretFromFile(flags *pflag.FlagSet, secret string) {
value, err := flags.GetString(secret)
if err != nil {
log.Error(err)
}
flag := flags.Lookup(secret)
value := flag.Value.String()
if value != "" && isFile(value) {
file, err := ioutil.ReadFile(value)
if err != nil {
log.Fatal(err)
}
flag := flags.Lookup(secret)
if flag.Value.Type() == "stringArray" {
rows := bytes.Split(file, []byte{'\n'})