Skip to content

Commit

Permalink
feat(snap): add support for environment variable injection (#74)
Browse files Browse the repository at this point in the history
* feat(snap): add support for environment variable injection

* build: Upgrade edgex-snap-hooks for fix quotation bug

Signed-off-by: Farshid Tavakolizadeh <[email protected]>
  • Loading branch information
farshidtz authored Apr 25, 2022
1 parent 8b2fb15 commit 3238fc2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions snap/local/hooks/cmd/configure/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"strings"

hooks "github.com/canonical/edgex-snap-hooks/v2"
"github.com/canonical/edgex-snap-hooks/v2/log"
"github.com/canonical/edgex-snap-hooks/v2/options"
local "github.com/edgexfoundry/app-rfid-llrp-inventory/hooks"
)

Expand All @@ -49,6 +51,12 @@ func main() {

}

log.SetComponentName("configure")
if err := options.ProcessAppConfig("app-rfid-llrp-inventory"); err != nil {
hooks.Error(fmt.Sprintf("could not process options: %v", err))
os.Exit(1)
}

// read env var override configuration
envJSON, err = cli.Config(hooks.EnvConfig)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion snap/local/hooks/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/edgexfoundry/app-rfid-llrp-inventory/hooks

require github.com/canonical/edgex-snap-hooks/v2 v2.1.3
require github.com/canonical/edgex-snap-hooks/v2 v2.2.0-beta.5

go 1.17
4 changes: 2 additions & 2 deletions snap/local/hooks/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/canonical/edgex-snap-hooks/v2 v2.1.3 h1:mcV/atn6k6sN6Uik+lSQGEZi4Q6r96epgBW+u6AGZ3Y=
github.com/canonical/edgex-snap-hooks/v2 v2.1.3/go.mod h1:rOxrwdYL7hJDhxFH3uV+nVgLPjWOhJWgM5PRD5YG1jI=
github.com/canonical/edgex-snap-hooks/v2 v2.2.0-beta.5 h1:EDFjmHy8CG4T8uFPqD+Per8Hgk250PvRsMgEDCXjYtE=
github.com/canonical/edgex-snap-hooks/v2 v2.2.0-beta.5/go.mod h1:rOxrwdYL7hJDhxFH3uV+nVgLPjWOhJWgM5PRD5YG1jI=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down

0 comments on commit 3238fc2

Please sign in to comment.