- todd-crowderParticipant1 month, 2 weeks ago #45856
Hi, our server uses a Host setting of ‘localhost’ for elasticsearch. But for local development we use DDEV/Docker and host is ‘elasticsearch’. When we download a database from server to work, we have to manually change host each time for the indexes.
Is there a config setting to allow us to set the host for elasticsearch?
If not that would be a great help for development. Better if all settings could be overridden.
thankstodd-crowderParticipant1 month, 2 weeks ago #45858Yes, but that’s a manual process. I might as well manually change it in the UI. It’s just the one setting.
This also makes it hard to do automated testing if we can’t automatically set the host setting in a config file to override production settings. For example, Redis plugins allow you to set config settings that override the default set in the plugin for development and automated testing.
Please consider making at least host a config setting so we can override. I bet people would also like port #.
thankstodd-crowderParticipant1 month, 2 weeks ago #45860When you setup an elasticsearch index in wpsolr, you give the hostname of the elasticsearch instance to talk to. That’s the setting that would be good to allow us to override with a config setting.
Then when I run my automated testing, I spin up a docker instance with elasticsearch, which in DDEV is ‘elasticsearch’, but could be anything. So I need to change that when I grab the production database. All our other enterprise plugins allow us to use config settings to override the hostname, port of services. So this would be really helpful.
todd-crowderParticipant1 month, 2 weeks ago #45862Yes, here’s how Redis cache does it:
https://github.com/rhubarbgroup/redis-cache/#configuration
WP_REDIS_HOST 127.0.0.1 The hostname of the Redis server
WP_REDIS_PORT 6379 The port of the Redis server
etc.
It’s really good because I can set those in my local dev and keep the production settings in the plugin configuration itself. My local settings override the plugins. Works great for automated testing too.
thankstodd-crowderParticipant1 month, 2 weeks ago #45864in wp-config.php. I can set production to it’s values and on dev to different values (same as changing db settings that way).
or in my case I’m using dot-env with Bedrock https://roots.io/bedrock/, and I have a .env that has all my local settings.
wpsolrKeymaster1 month, 2 weeks ago #45866I understand now. Basically, a defined PHP constant can be set to override the database settings, loaded by some WP code or by external frameworks like BedRock .env
The problem being that WPSolr supports multi-indexes, multi-views configuration. Some engines use a domain, some an endpoint, some http/https, some ports, and so on.
Which implies that the constant must be able to map the same multi-level structure as the full settings.
I have think about that before acting.
todd-crowderParticipant1 month, 2 weeks ago #45867yes, or a json file that let’s us override whatever is needed, but connection information is probably enough for everyone.
if we’re on a dev domain, look for an override file and load over saved settings.
Or, we could export all settings, change what’s needed, and the whole config file is loaded each time instead of plugin settings, or auto-loads if changed? it’s dev, so that would be ok.
thanks for considering
You must be logged in to reply to this topic.