-
Notifications
You must be signed in to change notification settings - Fork 48
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): use updated environment variable injection #407
Merged
lenny-goodell
merged 3 commits into
edgexfoundry:main
from
MonicaisHer:EDGEX-429-integrate-env-var-injection
Apr 26, 2022
Merged
feat(snap): use updated environment variable injection #407
lenny-goodell
merged 3 commits into
edgexfoundry:main
from
MonicaisHer:EDGEX-429-integrate-env-var-injection
Apr 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Mengyi Wang <[email protected]>
Signed-off-by: Mengyi Wang <[email protected]>
10 tasks
Signed-off-by: Mengyi Wang <[email protected]>
farshidtz
approved these changes
Apr 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM.
Validate the error handling:
$ snap set edgex-app-service-configurable config.service-startupmsg="testing injection"
error: cannot perform the following tasks:
- Run configure hook of "edgex-app-service-configurable" snap (run hook "configure":
-----
edgex-app-service-configurable.configure: could not process options: 'config.' and 'apps.' options are allowed only when config-enabled is true.
WARNING: Setting config-enabled=true will unset existing 'env.' options and ignore future sets!!
-----)
$ snap set edgex-app-service-configurable config-enabled=true
$ snap set edgex-app-service-configurable apps.app-service-configurable.config.service.port=11111
error: cannot perform the following tasks:
- Run configure hook of "edgex-app-service-configurable" snap (run hook "configure": edgex-app-service-configurable.configure: could not process options: error converting config key to environment variable key: config key must not contain dots: service.port)
Test:
$ snap set edgex-app-service-configurable config-enabled=true
$ snap set edgex-app-service-configurable config.service-startupmsg="testing injection"
$ snap start edgex-app-service-configurable
Started.
$ snap logs -n=all edgex-app-service-configurable | grep "testing injection"
2022-04-26T11:19:13+02:00 edgex-app-service-configurable.app-service-configurable[50155]: level=INFO ts=2022-04-26T09:19:13.04886399Z app=app-rules-engine source=variables.go:352 msg="Variables override of 'Service.StartupMsg' by environment variable: SERVICE_STARTUPMSG=testing injection"
2022-04-26T11:19:13+02:00 edgex-app-service-configurable.app-service-configurable[50155]: level=INFO ts=2022-04-26T09:19:13.073178783Z app=app-rules-engine source=variables.go:352 msg="Variables override of 'Service.StartupMsg' by environment variable: SERVICE_STARTUPMSG=testing injection"
2022-04-26T11:19:13+02:00 edgex-app-service-configurable.app-service-configurable[50155]: level=INFO ts=2022-04-26T09:19:13.104004057Z app=app-rules-engine source=service.go:203 msg="testing injection"
$ snap set edgex-app-service-configurable apps.app-service-configurable.config.service-port=11111
$ snap restart edgex-app-service-configurable
Restarted.
$ snap logs -n=all edgex-app-service-configurable | grep "11111"
2022-04-26T11:19:49+02:00 edgex-app-service-configurable.app-service-configurable[50464]: level=INFO ts=2022-04-26T09:19:49.654567422Z app=app-rules-engine source=variables.go:352 msg="Variables override of 'Service.Port' by environment variable: SERVICE_PORT=11111"
2022-04-26T11:19:49+02:00 edgex-app-service-configurable.app-service-configurable[50464]: level=INFO ts=2022-04-26T09:19:49.669203327Z app=app-rules-engine source=variables.go:352 msg="Variables override of 'Service.Port' by environment variable: SERVICE_PORT=11111"
2022-04-26T11:19:49+02:00 edgex-app-service-configurable.app-service-configurable[50464]: level=INFO ts=2022-04-26T09:19:49.696564382Z app=app-rules-engine source=server.go:162 msg="Starting HTTP Web Server on address localhost:11111"
$ cat /var/snap/edgex-app-service-configurable/current/config/res/app-service-configurable.env
export SERVICE_STARTUPMSG="testing injection"
export SERVICE_PORT="11111"
lenny-goodell
approved these changes
Apr 26, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For details on the new scheme for setting environment variables, please refer to edgexfoundry/edgex-go#3986.
Signed-off-by: Mengyi Wang [email protected]
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/app-service-configurable/blob/main/.github/CONTRIBUTING.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:
describing the break)Testing Instructions
New Dependency Instructions (If applicable)