goodrobots / MAVCesium

An experimental web based map display for MAVProxy based on Cesium
https://gitter.im/goodrobots/Lobby
GNU General Public License v3.0
40 stars 22 forks source link

Configurable config? #21

Closed fnoop closed 6 years ago

fnoop commented 7 years ago

New config parsing master code loads config (and api key) from mavproxy directory. This has two problems:

SamuelDudley commented 7 years ago

The default config is the last option which is used when all other options have failed. By default it will look for config files in the following order:

  1. _conf_file_path = os.path.join(os.environ['HOME'], ".mavcesium.ini")
  2. _conf_file_path = os.path.join(os.environ['LOCALAPPDATA'], "MAVProxy", "mavcesium.ini")
  3. If the above 2 fail it will load the default config mavcesium_default.ini from the MAVProxy directory https://github.com/SamuelDudley/MAVCesium/blob/master/app/config.py#L18

Try adding a custom config file called .mavcesium.ini (note the leading dot) to your users home directory. It should be used over the default config file when you next run MAVCesium. Note that the path of the config file which is used is printed to the MAVProxy console when MAVCesium loads.

This behaviour does not fix the issue of running multiple instances. To support that feature a config file path will need to be supplied at launch.

SamuelDudley commented 7 years ago

Having a bit more of a think about this... I could make a two step process to start the server from MAVProxy.

  1. Import the module. loads default config but does not start the server.
  2. User enters optional config path mavcesium load path_to_config
  3. User runs the server using the new config file. mavcesium start

Any thoughts?

fnoop commented 7 years ago

I think that sounds a bit complex, also won't allow auto-starting. Is there any way of passing an extra argument to mavproxy, that can then be used by mavcesium? That way you could specify the desired config to mavproxy at start.

SamuelDudley commented 7 years ago

I dont think that functionality exists at the moment but would be pretty simple to add. I'll work on a MAVProxy PR to add it.

SamuelDudley commented 7 years ago

@fnoop I would be grateful if you could +1 the MAVProxy PR: https://github.com/ArduPilot/MAVProxy/pull/452

fnoop commented 6 years ago

Now that mavcesium is standalone, could a specific config file location parameter be added?

SamuelDudley commented 6 years ago

I have pushed some changes to #35 which allows the application to be ran with --configuration="/somepath/config.ini" . This should solve your problem :)

fnoop commented 6 years ago

Works great, thanks :)