Config from environment variables

Noma

Member
Is it possible to provide the ElasticSearch configuration - mainly the hostname - to come from an environment variable instead of from the input field in the admin? I'm setting up a Xenforo installation in a cloud environment, and would be very handy if it could be read from an env variable.
 
Yes. In your config.php file:

PHP:
$c->extend('options', function ($options) {
    $options['xfesConfig']['host'] = getenv('XF_SEARCH_HOST');
});

You can set pretty much any option this way, so long as you can figure out its name and expected value format.
 
Top Bottom