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

Add support for XML environmental variables parsing [10697] #1517

Closed

Conversation

mauropasse
Copy link

This commit would allow to use OS environmental variables in XML profiles. For example:

# In bash terminal
export ROBOT_IP_ADDRESS=192.168.0.1

# In XML profile
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
    <participant profile_name="env_var_parsing_example">
        <rtps>
            <builtin>
                <initialPeersList>
                    <locator>
                        <udpv4>
                            <address>ROBOT_IP_ADDRESS</address>
                        </udpv4>
                    </locator>
                </initialPeersList>
            </builtin>
        </rtps>
    </participant>
</profiles>

@richiware
Copy link
Member

Build status:

  • Linux Build Status
  • Linux aarch64Build Status
  • Mac Build Status
  • Windows Build Status

@irobot-ros
Copy link

Hi, sorry for resurrecting this old PR.
Is there anything that is preventing it to be merged?

@MiguelCompany MiguelCompany changed the title Add support for XML environmental variables parsing Add support for XML environmental variables parsing [10697] Feb 26, 2021
@MiguelCompany
Copy link
Member

@irobot-ros Just that we did not have time to review it. Will do it now.

Copy link
Member

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this is a nice-to-have feature, it cannot be merged as-is.

First, it is only adding the possibility to use an environmental variable on pure string values. I think we should replace every tinyxml2::XMLElement::GetText method call with a call to an auxiliary method receiving a tinyxml2::XMLElement* and returning a const char*, that will be the one performing the environmental variable access.

Methods XMLParser::getXMLInt, XMLParser::getXMLUint, and XMLParser::getXMLBool should also include environmental variable support.

I also think that using a special character (like $) to clearly indicate the environmental variable should be used is desirable.

Using method std::getenv gives a warning on Windows about that method being unsafe.

Finally, adding this new feature should add tests and documentation for it. I suggest extending the unit tests on this file, and adding the corresponding PR to the documentation repo

@JLBuenoLopez
Copy link
Contributor

Hi @irobot-ros,

The base branch for this PR (2.0.x) is becoming EOL (end of life) this very month (see release support document). This is not going to be merged into this branch because there is still work pending. If you want to keep this PR open, you can change the base branch to one of the branches still alive and rebase it: 2.1.x used in ROS 2 Foxy, 2.3.x used in ROS 2 Galactic, or directly to master.

Sorry for the inconvenience!

@alsora
Copy link
Contributor

alsora commented Feb 22, 2022

Sure, sorry for keeping this PR open for so long but we didn't have time to fully implement it as requested.
Will close this PR.

@JLBuenoLopez
Copy link
Contributor

JLBuenoLopez commented Mar 16, 2023

I am closing this PR, though the feature is something which will be interesting to have in Fast DDS. I have opened #3377 to keep track of this feature. Also, this PR is targeting a branch that is no longer alive. A PR targeting master with this feature can be opened in the future.

@mauropasse
Copy link
Author

#3841
This PR should add support for this feature

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.

6 participants