From 0eee028e050f8a1bb8e1a188692f2d1cdc061775 Mon Sep 17 00:00:00 2001 From: Mengyi Wang Date: Thu, 21 Apr 2022 17:58:30 +0200 Subject: [PATCH] feat(snap): use updated environment variable injection Signed-off-by: Mengyi Wang --- snap/local/hooks/cmd/configure/configure.go | 8 ++++++++ snap/local/hooks/go.mod | 2 +- snap/local/hooks/go.sum | 12 ++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 snap/local/hooks/go.sum diff --git a/snap/local/hooks/cmd/configure/configure.go b/snap/local/hooks/cmd/configure/configure.go index c59a138d..3cc90db9 100644 --- a/snap/local/hooks/cmd/configure/configure.go +++ b/snap/local/hooks/cmd/configure/configure.go @@ -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/device-gpio-go/hooks" ) @@ -99,4 +101,10 @@ func main() { hooks.Error(fmt.Sprintf("Invalid value for 'autostart' : %s", autostart)) os.Exit(1) } + + log.SetComponentName("configure") + if err := options.ProcessAppConfig("device-mqtt"); err != nil { + hooks.Error(fmt.Sprintf("could not process options: %v", err)) + os.Exit(1) + } } diff --git a/snap/local/hooks/go.mod b/snap/local/hooks/go.mod index 7dd50a16..1c8aebec 100644 --- a/snap/local/hooks/go.mod +++ b/snap/local/hooks/go.mod @@ -1,5 +1,5 @@ module github.com/edgexfoundry/device-gpio-go/hooks -require github.com/canonical/edgex-snap-hooks/v2 v2.0.3 +require github.com/canonical/edgex-snap-hooks/v2 v2.2.0-beta.2.0.20220420075917-7fdbcd41ba0b go 1.16 diff --git a/snap/local/hooks/go.sum b/snap/local/hooks/go.sum new file mode 100644 index 00000000..85c7acbd --- /dev/null +++ b/snap/local/hooks/go.sum @@ -0,0 +1,12 @@ +github.com/canonical/edgex-snap-hooks/v2 v2.2.0-beta.2.0.20220420075917-7fdbcd41ba0b h1:vKrKzgdZo3kk0mptvQ1vvUUUQ2eYjE+nDMhT2tC9UJw= +github.com/canonical/edgex-snap-hooks/v2 v2.2.0-beta.2.0.20220420075917-7fdbcd41ba0b/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= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=