Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snap): add support for environment variable injection #75

Conversation

farshidtz
Copy link
Member

@farshidtz farshidtz commented Apr 25, 2022

For details on the new scheme for setting environment variables, please refer to edgexfoundry/edgex-go#3986.

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-rfid-llrp-inventory/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?): Add tests for snap config options canonical/edgex-snap-testing#53
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

  1. Set up:
snap install edgexfoundry --edge
snap install edgex-device-rfid-llrp --channel=edge/pr-75
  1. Enable config and set a global config value:
$ snap set edgex-device-rfid-llrp config-enabled=true
$ snap set edgex-device-rfid-llrp config.service-startupmsg="testing injection"

$ snap start edgex-device-rfid-llrp
Started.

$ snap logs -n=all edgex-device-rfid-llrp | grep "testing injection"
2022-04-25T21:21:48+02:00 edgex-device-rfid-llrp.device-rfid-llrp[592246]: level=INFO ts=2022-04-25T19:21:48.571255952Z app=device-rfid-llrp source=variables.go:352 msg="Variables override of 'Service.StartupMsg' by environment variable: SERVICE_STARTUPMSG=testing injection"
2022-04-25T21:21:49+02:00 edgex-device-rfid-llrp.device-rfid-llrp[592246]: level=INFO ts=2022-04-25T19:21:49.102146213Z app=device-rfid-llrp source=message.go:55 msg="testing injection"
  1. Set a app-specific value:
$ snap set edgex-device-rfid-llrp apps.device-rfid-llrp.config.service-port=11111

$ snap restart edgex-device-rfid-llrp
Restarted.

$ snap logs -n=all edgex-device-rfid-llrp | grep "11111"
2022-04-25T21:14:55+02:00 edgex-device-rfid-llrp.device-rfid-llrp[584932]: level=INFO ts=2022-04-25T19:14:55.14407642Z app=device-rfid-llrp source=variables.go:352 msg="Variables override of 'Service.Port' by environment variable: SERVICE_PORT=11111"
2022-04-25T21:14:55+02:00 edgex-device-rfid-llrp.device-rfid-llrp[584932]: level=INFO ts=2022-04-25T19:14:55.184841881Z app=device-rfid-llrp source=httpserver.go:123 msg="Web server starting (localhost:11111)"

New Dependency Instructions (If applicable)

@codecov-commenter
Copy link

Codecov Report

Merging #75 (d06d514) into main (5b207c8) will increase coverage by 0.07%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #75      +/-   ##
==========================================
+ Coverage   41.08%   41.16%   +0.07%     
==========================================
  Files          21       21              
  Lines        9016     9016              
==========================================
+ Hits         3704     3711       +7     
+ Misses       4143     4138       -5     
+ Partials     1169     1167       -2     
Impacted Files Coverage Δ
internal/llrp/reader.go 41.24% <0.00%> (+0.66%) ⬆️
internal/retry/retry.go 94.65% <0.00%> (+3.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b207c8...d06d514. Read the comment docs.

@farshidtz farshidtz marked this pull request as ready for review April 25, 2022 19:26
@farshidtz farshidtz changed the title feat(snap): use updated environment variable injection feat(snap): add support for environment variable injection Apr 25, 2022
@farshidtz
Copy link
Member Author

The commit is from @MonicaisHer. I have reviewed, tesed the changes, and created this PR.

@lenny-goodell lenny-goodell merged commit c528429 into edgexfoundry:main Apr 25, 2022
@farshidtz farshidtz deleted the EDGEX-428-integrate-env-var-injection-with-device-rfid-llrp-snap branch April 25, 2022 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants