From cbbf6b73ff5aa3dadd3aae09369d4fdaeb283926 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sat, 16 Mar 2019 13:59:20 +0100 Subject: [PATCH] Support store settings (#28) --- request/fetch.go | 9 +++++++-- request/process.go | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/request/fetch.go b/request/fetch.go index db6070e..07ec53e 100644 --- a/request/fetch.go +++ b/request/fetch.go @@ -64,8 +64,13 @@ func fetchDecryptedContents(request *request) { } store.Path = normalizedStorePath - gpgPath := request.Settings.GpgPath - if gpgPath != "" { + var gpgPath string + if store.Settings.GpgPath != "" || request.Settings.GpgPath != "" { + if store.Settings.GpgPath != "" { + gpgPath = store.Settings.GpgPath + } else { + gpgPath = request.Settings.GpgPath + } err = validateGpgBinary(gpgPath) if err != nil { log.Errorf( diff --git a/request/process.go b/request/process.go index a729dd4..0182bfa 100644 --- a/request/process.go +++ b/request/process.go @@ -11,10 +11,15 @@ import ( log "github.com/sirupsen/logrus" ) +type storeSettings struct { + GpgPath string `json:"gpgPath"` +} + type store struct { - ID string `json:"id"` - Name string `json:"name"` - Path string `json:"path"` + ID string `json:"id"` + Name string `json:"name"` + Path string `json:"path"` + Settings storeSettings `json:"settings"` } type settings struct {