Add env.
This commit is contained in:
parent
4cbde2749d
commit
c8385f4b55
|
|
@ -22,7 +22,8 @@ def main():
|
|||
web.get('/', routes.root),
|
||||
web.get('/ping', routes.ping),
|
||||
web.get('/uptime', routes.uptime),
|
||||
web.get('/build_info', routes.build_info)
|
||||
web.get('/build_info', routes.build_info),
|
||||
web.get('/env', routes.env)
|
||||
])
|
||||
web.run_app(app)
|
||||
|
||||
|
|
@ -33,6 +34,20 @@ class Facts:
|
|||
def get_uptime(self):
|
||||
return time.monotonic() - self._start_time
|
||||
|
||||
def get_env(self):
|
||||
env = {}
|
||||
# We're not going to return the whole environment because
|
||||
# of security.
|
||||
# Let's pick the ones we want.
|
||||
env['ROS_AUTOMATIC_DISCOVERY_RANGE'] = os.environ.get('ROS_AUTOMATIC_DISCOVERY_RANGE', None)
|
||||
env['AMENT_PREFIX_PATH'] = os.environ.get('AMENT_PREFIX_PATH', None)
|
||||
env['ROS_DISTRO'] = os.environ.get('ROS_DISTRO', None)
|
||||
env['RMW_IMPLEMENTATION'] = os.environ.get('RMW_IMPLEMENTATION', None)
|
||||
env['ROS_NAMESPACE'] = os.environ.get('ROS_NAMESPACE', None)
|
||||
env['CYCLONEDDS_URI'] = os.environ.get('CYCLONEDDS_URI', None)
|
||||
|
||||
return env
|
||||
|
||||
def get_buildinfo(self):
|
||||
# Find the share directory for 'build_info_getter'.
|
||||
build_info_getter_directory = None
|
||||
|
|
@ -77,5 +92,6 @@ class Routes:
|
|||
project_state["status"] = True
|
||||
return web.json_response(project_state)
|
||||
|
||||
|
||||
|
||||
async def env(self, request):
|
||||
env = self._facts.get_env()
|
||||
return web.json_response(env)
|
||||
|
|
|
|||
Loading…
Reference in New Issue