-
Notifications
You must be signed in to change notification settings - Fork 485
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 #3924
feat(snap): use updated environment variable injection #3924
Conversation
Signed-off-by: Siggi Skulason <[email protected]>
Signed-off-by: Siggi Skulason <[email protected]>
Use ProcessAppConfig instead of ProcessOptions Signed-off-by: siggi <[email protected]>
Signed-off-by: siggi <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@farshidtz - this is now ready for review- it uses version v2.2.0-beta.2 of the snap hooks. |
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.
It works according to the given instructions:
$ sudo snap set edgexfoundry env.core-data.service.host=localhost
$ sudo snap set edgexfoundry apps.core-data.config.service.port=8080
$ sudo snap set edgexfoundry config.debug=true
$ cat /var/snap/edgexfoundry/current/config/core-data/res/core-data.env
export SERVICE_HOST=localhost
export DEBUG=true
export SERVICE_PORT=8080
$ cat /var/snap/edgexfoundry/current/config/core-command/res/core-command.env
export DEBUG=true
But there is a bug for services that don't have env.*
legacy options and only the new ones:
- env vars keep getting appended to the env files:
$ sudo snap set edgexfoundry apps.core-command.config.x=true
$ sudo snap set edgexfoundry apps.core-command.config.x=true
$ sudo snap set edgexfoundry apps.core-command.config.x=true
$ cat /var/snap/edgexfoundry/current/config/core-command/res/core-command.env
export DEBUG=true
export X=true
export X=true
export X=true
- unset does not remove the env var:
$ sudo snap unset edgexfoundry apps.core-command.config.x
$ cat /var/snap/edgexfoundry/current/config/core-command/res/core-command.env
export DEBUG=true
export X=true
export X=true
export X=true
As discussed with @siggiskulason, this is because the new functions try to be backwards compatible by appending to env files, while the old functions always read all snap options and write the env file from scratch.
Thanks @siggiskulason for this addition. I've added a new PR (#3986) with some fixes and additions. I'm going to close this in favor of the other PR. |
Signed-off-by: Siggi Skulason [email protected]
This PR updates edgex-go to use the new environment variable injection.
If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md
PR Checklist
Please check if your PR fulfills the following requirements:
BREAKING CHANGE:
describing the break)Testing Instructions
Do
New Dependency Instructions (If applicable)