[RVI] configuration file format

Wiger, Ulf uwiger at jaguarlandrover.com
Mon Aug 1 12:19:52 EDT 2016


I have written a config script for RVI that can be used with the existing
rvi-0.5.

https://github.com/GENIVI/rvi_core/pull/105

The invocation is a bit unelegant right now, but I thought I'd extend setup
to make it more intuitive.

Interpreted config scripts are a bit harder to debug than compiled code,
but they have the advantage that they can be added by the user without
requiring any updates to RVI.

The facility is used in part of the test suite configs:

priv/config/backend.config:

%% -*- erlang -*-
{ok, CurDir} = file:get_cwd().
D = filename:dirname(filename:absname(SCRIPT)).
F = filename:join(D,"rvi_core/priv/config/load_ini.config").
I = filename:join(D, "rvi_core/priv/test_config/my_ini.config").
{ok, Instr} = file:script(F, [{'FILE', I}]).
[
 {include_lib, "rvi_core/priv/config/rvi_backend.config"}
 | Instr
].

What this _should_ be (after extending setup) is:

D = filename:dirname(SCRIPT).
[
 {include_lib, "rvi_core/priv/config/rvi_backend.config"},
 {include_lib, "rvi_core/priv/config/load_ini.config",
  [{'FILE', filename:join(D, "my_ini.config")}]}

].

The load_ini.config script starts by defining a mapping structure
(ConfigMap,
https://github.com/uwiger/rvi_core/blob/3bbe0ea1d1381b99a625fdd2f49896102865ee3d/priv/config/load_ini.config#L19),
which can fairly easily be extended to support more config variables.

A similar approach could be used for other formats as well. Parsing for
JSON would require less code, since a JSON parser (jsx) already exists in
the code path.

BR,
Ulf W

On 1 August 2016 at 07:51, Jamison, Tatiana <tjamison at jaguarlandrover.com>
wrote:

> Great - thanks for the input. I'll stick with sysctl-style but keep JSON
> in mind if it needs more structure.
>
> On 29 July 2016 at 18:12, Jeremiah Foster <jeremiah.foster at pelagicore.com>
> wrote:
>
>> On Jul 29, 2016 6:05 PM, "Streif, Rudolf" <rstreif at jaguarlandrover.com>
>> wrote:
>> >
>> > For what's worth it, I personally never cared for the INI file format
>> as it is too easy to miss a section and mess it up in longer files. It's
>> also more effort to parse it.
>> >
>> > For simple configuration with a pseudo hierarchy I prefer:
>> >
>> > path.to.property.0 = value0
>> > path.to.property.1 = value1
>> >
>> > It's easy to parse and can be used in a tree.
>> >
>> > If it needs more flexibility and lists, dicts etc. I would use JSON.
>>
>> +1
>>
>> FWIW GENIVI uses JSON in a couple of other projects.
>>
>> Regards,
>>
>> Jeremiah
>>
>> >
>> > Cheers,
>> > Rudi
>> >
>> > On Fri, Jul 29, 2016 at 2:03 PM, Jamison, Tatiana <
>> tjamison at jaguarlandrover.com> wrote:
>> >>
>> >> Hi all,
>> >>
>> >> For the client implementation of RVI in C, the user will specify a
>> configuration file in the calling application. This configuration file will
>> specify the location of device certificate and key, the trusted certificate
>> store, RVI credentials, and addresses of remote nodes to connect to on
>> startup (if any).
>> >>
>> >> Any strong opinions on the format of this file? I'm thinking INI style
>> (also used by OpenSSL), with a structure like:
>> >>
>> >> [section0]
>> >> property0 = value0
>> >> property1 = value1
>> >> ...
>> >>
>> >> --
>> >> Tatiana Jamison
>> >> Software Developer
>> >>
>> >> Jaguar Land Rover North America, LLC
>> >> 1419 NW 14th Ave. Portland. OR 97209
>> >> JaguarUSA.com  |  LandRoverUSA.com
>> >
>> >
>> >
>> >
>> > --
>> > Rudolf J Streif
>> > System Architect - Open Source Initiative
>> > Open Source Technology Centre
>> >
>> > M: +1.619.631.5383
>> > Email:  rstreif at jaguarlandrover.com
>> >
>> >
>> >
>> > UK: G/26/2 G02 Building 523, Engineering Centre, Gaydon, Warwick, CV35
>> ORR
>> > US: 1419 NW 14th Ave, Portland, OR 97209
>> > jaguar.com | landrover.com
>> > -------------------
>> > Business Details:
>> > Jaguar Land Rover Limited
>> > Registered Office: Abbey Road, Whitley, Coventry CV3 4LF
>> > Registered in England No: 1672070
>> >
>> > This e-mail and any attachments contain confidential information for a
>> specific individual and purpose.  The information is private and privileged
>> and intended solely for the use of the individual to whom it is addressed.
>> If you are not the intended recipient, please e-mail us immediately.  We
>> apologise for any inconvenience caused but you are hereby notified that any
>> disclosure, copying or distribution or the taking of any action in reliance
>> on the information contained herein is strictly prohibited.
>> >
>> > This e-mail does not constitute an order for goods or services unless
>> accompanied by an official purchase order.
>> >
>> >
>> > _______________________________________________
>> > genivi-projects mailing list
>> > genivi-projects at lists.genivi.org
>> > http://lists.genivi.org/cgi-bin/mailman/listinfo/genivi-projects
>> >
>>
>
>
>
> --
> *Tatiana Jamison*
> Software Developer
>
> Jaguar Land Rover North America, LLC
> 1419 NW 14th Ave. Portland. OR 97209
> JaguarUSA.com <http://www.jaguarusa.com/index.html>  |  LandRoverUSA.com
> <http://www.landrover.com/us/en/lr>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genivi.org/pipermail/genivi-projects_lists.genivi.org/attachments/20160801/6c1a01a4/attachment.html>


More information about the genivi-projects mailing list