`RTAddressRegexp` Configuration Database Override

Hello,
I want to do RT configurations ideally from config files from my RT_SiteConfig.pm config file. I want to set RT address to have more than one RT address. When I set this on my above config file
Set($RTAddressRegexp, '^(mail1@mail.com)|(mail2@mail2.com)$ RT keeps throwing the below error:

: [3483052] Change of config option 'RTAddressRegexp' at /opt/rt5/etc/RT_SiteConfig.pm line 40 has been overridden by the config setting from the database. Please remove it from /opt/rt5/etc/RT_SiteConfig.pm or from the database to avoid confusion. at /opt/rt5/sbin/../lib/RT/Config.pm line 2724.

Is there a way to to configure RT to take configs from RT_SiteConfig.pm so that they override DB settings and not the other way round?

or anyone knows where exactly on DB this is set so that I just remove them.

On some of our RT5.x servers we’ve got a local version of lib/RT/Config.pm that allows us to use a config option to turn off the database as a config source. Here’s the patch that the local version has:

diff -c /opt/rt5/local/lib/RT/Config.pm /opt/rt5/lib/RT/Config.pm
*** /opt/rt5/local/lib/RT/Config.pm 2021-07-14 15:55:06.074744905 +0100
— /opt/rt5/lib/RT/Config.pm 2021-02-26 14:41:12.709096668 +0000


*** 2492,2502 ****
}

  $META{$name}->{'Type'} = $type;

! my @ConfigSources = qw(Package File Line SiteConfig Extension Database);
! if($self->Get(‘ConfigFromFiles’)) {
! @ConfigSources = qw(Package File Line SiteConfig Extension);
! }
! foreach (@ConfigSources) {
$META{$name}->{‘Source’}->{$} = $args{$};
}
$self->Set( $name, @{ $args{‘Value’} } );
— 2492,2498 ----
}

  $META{$name}->{'Type'} = $type;

! foreach (qw(Package File Line SiteConfig Extension Database)) {
$META{$name}->{‘Source’}->{$} = $args{$};
}
$self->Set( $name, @{ $args{‘Value’} } );

With this in place we just have ConfigFromFiles set in our local RT_SiteConfig.pm and it stops RT from trying to put it into the database. We much prefer this, as it means that the config files can be kept under version control using git.

Okay thanks, let me try this

Hello,
I copied the config file from cp /opt/rt5/lib/RT/Config.pm /opt/rt5/local/lib/RT/ and edited the local config to inculde the above config:


But getting same error, only that this time it complains of the Local config

hange of config option 'RTAddressRegexp' at /opt/rt5/etc/RT_SiteConfig.pm line 44 has been overridden by the config setting from the database. Please remove it from /opt/rt5/etc/RT_SiteConfig.pm or from the database to avoid confusion. at /opt/rt5/sbin/../local/lib/RT/Config.pm line 2728.

Now back to my question, how do i remove configs set on DB?

Did you set the ConfigFromFiles option to true in your RT_SiteConfig.pm and then restart RT?

Not really, what is the exact parameter to set, cannot find it on RT_config docs

It won’t be in the RT docs because its not a standard option: its just one I made up to be used by that patch. You need to add a line to your RT_SiteConfig.pm file that says:

Set($ConfigFromFiles, 1);

then clear the Mason cache and restart the web server RT is on so that it picks up the config afresh. This should (hopefully!) mean it will not look at the database version of the config at all (so bare that in mind if you’ve added/changed configuration options using the Web UI and not put them manually back into your file system based config files).

I set the above Set($ConfigFromFiles, 1);, cleared Mason cache, but upon restarting throws the same error :frowning:

`

Sorry, I can’t help then!

Thanks for trying :slight_smile:

The only other think I can suggest is looking at the Configurations table in your database and see if you can spot a row that includes the RTAddressRegexp that you can remove (after making a database backup obviously Just In Case). I can’t tell you what that would exactly look like though as our RTs read their configs from the files! :slight_smile:

Found out the configs are on Web UI System Configuration, and managed to change the comment address did not achieve my goal per se anyways.
Funny thing is RT is contradicting itself on where to set RTAddressRegexp on GUI (Which from the looks of it is the DB Overwrite) says the changes have to be done on Site config file, but the logs say Database configs overwrite it :face_with_raised_eyebrow:
Config on Web UI:

After setting this on Site Config, the logs throw the error:

 Change of config option 'RTAddressRegexp' at /opt/rt5/etc/RT_SiteConfig.pm line 44 has been overridden by the config setting from the database. Please remove it from /opt/rt5/etc/RT_SiteConfig.pm or from the database to avoid confusion. at /opt/rt5/sbin/../local/lib/RT/Config.pm line 2728.

RT be confusing sometimes :person_facepalming:

Just a thought: have you actually tried to remove the RTAddressRegexp from the RT_SiteConfig.pm as the warning message tells you to?

Just did that, but still ccannot edit from Web Configurator on UI