-
Notifications
You must be signed in to change notification settings - Fork 641
[PR from CLI tool] Allow connectivity configs in MQTT demo to be CLI overridden #1124
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,11 @@ | |
* These configuration settings are required to run the basic TLS demo. | ||
* Throw compilation error if the below configs are not defined. | ||
*/ | ||
#ifndef BROKER_ENDPOINT | ||
#error "Please define an MQTT broker endpoint, BROKER_ENDPOINT, in demo_config.h." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this error ever trigger? Because we defined this macro in the config if it wasn't defined already There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the customer happens to remove it from the config file, then this failure would remind them instead. |
||
#endif | ||
#ifndef ROOT_CA_CERT_PATH | ||
#error "Please define path to Root CA certificate of the MQTT broker(ROOT_CA_CERT_PATH) in demo_config.h." | ||
#error "Please define path to Root CA certificate of the MQTT broker, ROOT_CA_CERT_PATH, in demo_config.h." | ||
#endif | ||
#ifndef CLIENT_IDENTIFIER | ||
#error "Please define a unique CLIENT_IDENTIFIER." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,9 @@ | |
* This demo uses the Mosquitto test server. This is a public MQTT server; do not | ||
* publish anything sensitive to this server. | ||
*/ | ||
#define BROKER_ENDPOINT "test.mosquitto.org" | ||
#ifndef BROKER_ENDPOINT | ||
#define BROKER_ENDPOINT "test.mosquitto.org" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The cautionary language on lines 53-55 is not sufficient here. From the test.mosquitto.org documentation, the test.mosquitto.org broker "...will often be running unreleased or experimental code and may not be as stable as you might hope.". Additional cautionary language on their website asks "...please do not abuse or rely upon it for anything of importance.". I would recommend removing references to test.mosquitto.org from this (and any other) MQTT demos. If someone wishes to use it, they of course may do so. However the best way to test this by running a broker locally, and we can easily provide instructions for setting up mosquitto or another broker to run locally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Such directions are available in the readme too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to Gary's comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a good suggestion to not suggest We could update the comments on our |
||
#endif | ||
|
||
/** | ||
* @brief Length of MQTT server host name. | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
The philosophy of this file demo_config.h already is that applications can edit it.
In mqtt_demo_basic_tls.c we should have:
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.
I agree, that our demo source files should have build-time failures for no definitions of these macros. Have added them in source files.
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.
So how would this build-time failures for no definitions of these macros work for our demo sources? Wont this file always define
BROKER_ENDPOINT
? So by the time we get to our demo source files, wont the check forifndef BROKER_ENDPOINT
always say thatBROKER_ENDPOINT
is defined?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 is to guard against accidental removals of the
BROKER_ENDPOINT
by the customer. It provides a helpful message to remind them that theBROKER_ENDPOINT
macro is required for the demo to run instead of giving them regular gcc build failures (at the source code points that use the macro)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.
This is still different from what the README says about Mutual Auth Demos.