Add value to array in RT_SiteConfig.pm

Hi.

Is it possible to add a value to array in config?

I want to add one custom script to @JSFiles, but cannot find
anything like Push() or Add() in config parser, only Set().
Is the only way copy all predefined array from RT_Config.pm to
RT_SiteConfig.pm?

The same question for add (or modify) some key/value of %Lifecycles hash
without copying it all to RT_SiteConfig.pm.

Thanks.

Pavel

Hi,

No, it is not possible. SiteConfig is loaded before core config.On Fri, Apr 26, 2013 at 1:12 PM, Pavel Gulchouck gul@gul.kiev.ua wrote:

Hi.

Is it possible to add a value to array in config?

I want to add one custom script to @JSFiles, but cannot find
anything like Push() or Add() in config parser, only Set().
Is the only way copy all predefined array from RT_Config.pm to
RT_SiteConfig.pm?

The same question for add (or modify) some key/value of %Lifecycles hash
without copying it all to RT_SiteConfig.pm.

Thanks.


Pavel

Best regards, Ruslan.

I want to add one custom script to @JSFiles, but cannot find
anything like Push() or Add() in config parser, only Set().
Is the only way copy all predefined array from RT_Config.pm to
RT_SiteConfig.pm?

For @JSFiles you have to copy (we’ve fixed this in the development
series). You also have to be careful on upgrades in case we add files
to @JSFiles.

If you’re writing a local extension, you want to use
http://bestpractical.com/rt/docs/latest/RT.html#AddJavaScript
from your code rather than munging the config.

The same question for add (or modify) some key/value of %Lifecycles hash
without copying it all to RT_SiteConfig.pm.

For Lifecyeles, if you want to change general you have to copy all of
general, but you can skip copying the approvals one.
We merge at the top level of that hash, but not deeper.

-kevin

I want to add one custom script to @JSFiles, but cannot find
anything like Push() or Add() in config parser, only Set().
Is the only way copy all predefined array from RT_Config.pm to
RT_SiteConfig.pm?

For @JSFiles you have to copy (we’ve fixed this in the development
series). You also have to be careful on upgrades in case we add files
to @JSFiles.

If you’re writing a local extension, you want to use
RT - RT 5.0.5 Documentation - Best Practical
from your code rather than munging the config.

You should be able to use this, somewhat hackishly but just fine, in a
local/etc/JS_Config.pm or etc/JS_Config.pm with this content:

RT->AddJavaScript("foo.js");
1;

You can’t do that from your RT_SiteConfig.pm for load order reasons, but
you can do so from additional config files.