-
Notifications
You must be signed in to change notification settings - Fork 54
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
Configurable http port #1596
Configurable http port #1596
Conversation
6783046
to
c10cf0e
Compare
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.
There is mix between http and mqtt fields.
The documentation related to file transfer should also be updated to tell how to set a specific HTTP port.
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.
You need to update the c8y-config-plugin here to use this http port setting.
pub(crate) struct HttpConfigDto { | ||
pub(crate) port: Option<u16>, | ||
pub(crate) bind_address: Option<IpAddress>, | ||
pub(crate) external_port: Option<u16>, | ||
pub(crate) external_bind_address: Option<IpAddress>, |
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.
@didier-wenzek, maybe i should have just kept port here, but I had in mind the scenario where we might want a http external address and mqtt on an internal one, or vice-versa
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.
sounds fine Oops no.
- It's really confusing to have these two addresses for MQTT. Let's avoid to have the same for HTTP.
- => Keep only
port
andbind_address
.
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.
If you add an http.bind_address
here, you have also to add an implementation for ConfigSettingAccessor<HttptBindAddressSetting>
and to use it in the mapper and the c8y_configuration plugin.
Note that the implementation of ConfigSettingAccessor<HttptBindAddressSetting>::query()
is a convenient place to implement the logic defaulting to the MQTT setting when nothings specific is set for HTTP.
Thanks, updated! |
|
||
//TODO: Port number to be read from HttpPortSetting | ||
let local_http_host = format!("{}:8000", bind_address.to_string().as_str()); | ||
let local_http_host = format!("{}:{}", bind_address.to_string().as_str(), http_port); |
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 bind address is computed after MqttBindAddressSetting
and MqttExternalBindAddressSetting
. These should be used only if no HTTP bind address has been configured (since you added the latter in HttpConfigDto
).
=> Add an implementation for ConfigSettingAccessor<HttptBindAddressSetting>::query()
defaulting to the MQTT setting when nothings specific is set for HTTP.
pub(crate) struct HttpConfigDto { | ||
pub(crate) port: Option<u16>, | ||
pub(crate) bind_address: Option<IpAddress>, | ||
pub(crate) external_port: Option<u16>, | ||
pub(crate) external_bind_address: Option<IpAddress>, |
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.
If you add an http.bind_address
here, you have also to add an implementation for ConfigSettingAccessor<HttptBindAddressSetting>
and to use it in the mapper and the c8y_configuration plugin.
Note that the implementation of ConfigSettingAccessor<HttptBindAddressSetting>::query()
is a convenient place to implement the logic defaulting to the MQTT setting when nothings specific is set for HTTP.
75e5bfd
to
a81d381
Compare
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.
Approved
Signed-off-by: alexandru solomes <solo@softwareag.com>
Signed-off-by: alexandru solomes <solo@softwareag.com>
Signed-off-by: alexandru solomes <solo@softwareag.com>
Added HttpBindAddressSetting to automatically choose between external bind address or "internal" bind address. It currently queries the values for mqtt.bind_address and mqtt.external.bind_address, choosing external over internal when available Signed-off-by: alexandru solomes <solo@softwareag.com>
a81d381
to
d549140
Compare
Signed-off-by: alexandru solomes <solo@softwareag.com>
d549140
to
bd8a4b0
Compare
Proposed changes
Added configurable http port in tedge.toml where default is 8000.
Types of changes
Paste Link to the issue
#1479
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments