Skip to content

Commit

Permalink
build(snap): Upgrade snap base to core22, upgrade env file loading lo…
Browse files Browse the repository at this point in the history
…gic (#4530)



Signed-off-by: Mengyi Wang <[email protected]>
  • Loading branch information
MonicaisHer authored May 3, 2023
1 parent 91109c3 commit 47e5a6d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 59 deletions.
2 changes: 1 addition & 1 deletion snap/local/helper-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/edgexfoundry/edgex-go/snap/local/helper-go

go 1.18

require github.com/canonical/edgex-snap-hooks/v3 v3.0.0-20230112170125-c0580fb68dab
require github.com/canonical/edgex-snap-hooks/v3 v3.0.0-20230413215958-a96e2a6a0cc6
2 changes: 2 additions & 0 deletions snap/local/helper-go/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/canonical/edgex-snap-hooks/v3 v3.0.0-20230112170125-c0580fb68dab h1:wpiKN0hX8tqeZNa4jPvgyrqP8ixm1Xu7lcQA3bypR7w=
github.com/canonical/edgex-snap-hooks/v3 v3.0.0-20230112170125-c0580fb68dab/go.mod h1:RvJ48YbdBPZn7L8OcylOpKIlIJD+nMjo5D7WSnPYusY=
github.com/canonical/edgex-snap-hooks/v3 v3.0.0-20230413215958-a96e2a6a0cc6 h1:VTttaJT+dJBM94EU9c2fCewIv0y7m6PVI4D134Bk6d0=
github.com/canonical/edgex-snap-hooks/v3 v3.0.0-20230413215958-a96e2a6a0cc6/go.mod h1:qGZwprCZGZk2pA9BrleUtSrGrfHIaIz1356p8aqzuN4=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ BINPATH="${ARGV[0]}"

# binary name == service name/key
SERVICE=$(basename "$BINPATH")
if [ -z $ENV_FILE ]; then
ENV_FILE="$SNAP_DATA/config/$SERVICE/res/$SERVICE.env"
fi
ENV_FILE="$SNAP_DATA/config/$SERVICE/overrides.env"
TAG="edgex-$SERVICE."$(basename "$0")

if [ -f "$ENV_FILE" ]; then
logger --tag=$TAG "sourcing $ENV_FILE"
set -o allexport
source "$ENV_FILE" set
set +o allexport
set +o allexport
else
logger --tag=$TAG --stderr "sourcing $ENV_FILE: not found!"
fi

exec "$@"

Loading

0 comments on commit 47e5a6d

Please sign in to comment.