[Bro-Dev] Configuration framework syntax proposal
johanna at corelight.com
Thu Sep 21 08:33:26 PDT 2017
On Thu, Sep 21, 2017 at 08:22:23AM -0700, Robin Sommer wrote:
> > comments. Like Jan, I had a hard time understanding the benefit having
> > two names for the same value: the identifier and config string.
> Yeah, that's been my original concern as well. What if we focused that
> new attribute just on displaying something to the user:
> const user_name: string &redef &display_name="User name"
I am not sure that we do need a new language element for that at all. If
we want a new attribute for just displaying information in a different
way, that (at least to me) feels more like something broxygen would do
(i.e. something that a script writer could put into one of the ## comments
if they so desire for the respective variable).
That being said, I still think it would be nice to have something in the
Bro language to denote that a value is a configuration option, mostly for
the reasons stated in the very first email. The biggest reason from my
point of view is strong typing - we tried to implement this just as Bro
scripts and it ends up not so nice.
So - how about something like this:
## The username for our new feature
## Display: Feature User Name
const user_name: string &config;
configopt user_name: string;
The comment block identifies the display name which can be picked up by
the UI (and documentation generation). The &config attribute (or the
configopt specifier) specifies this as a configuration option. The name in
the comment blocks also can be used for other language elements and will
be used in the documentation.
More information about the bro-dev