I’m trying to change some forum settings through the console. I didn’t do that a lot yet so I searched for similar questions on the forum.
Unfortunately when executing ‘bundle exec rails c’ i get an error trace that ends with this line
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-18.104.22.168/lib/active_record/connection_adapters/postgresql_adapter.rb:81:in `rescue in new_client': connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "discourse" (ActiveRecord::NoDatabaseError)
Any idea what’s going on there? Forum itself runs fine - just updated to the latest version the other day.
I get to the rails console from the server by using:
./launcher enter app
There’s an example of changing a site setting in this topic, Enable the hidden can_permanently_delete site setting (this one is a hidden one, but the method is the same)
Thanks, I guess I mixed up both - I was doing bundle exec from within the app.
Still struggling though. I’m looking to change the IP regex for the prometheus exporter plugin.
Not sure which syntax is good to use. I tried
SiteSetting.prometheus_trusted_ip_allowlist_regex=22.214.171.124 with escaping backslashes and quotes around it but nothing worked. 126.96.36.199 being a placeholder of my real IP.
Actually I just noticed it’s probably not a syntax issue
NoMethodError: undefined method `prometheus_trusted_ip_allowlist_regex=' for #<Class:0x000055a8093e7dd8>
Maybe @sam can help with that. Or I’m really just making a mistake here.
You must set
DISCOURSE_PROMETHEUS_TRUSTED_IP_ALLOWLIST_REGEX and a ENV variable on your app.yml file.
Correct me if I’m wrong but I thought I could set it on runtime first. So I need to set it on app.yml first to then be able to modify it on runtime?
The forum is quite busy so I was hoping to be able to set it on runtime first before setting it permanently in the ENV.
Any hints about the syntax? Can this just be
No runtime changes, only via the ENV.
It’s a Ruby Regex object, see https://rubular.com/
Yes, that works.