I'm using Sphinx search engine for my application, and I would like to add ruby code inside the sphinx.conf file to update some values dynamically based on my application server hostname? Is it possible to execute the ruby code inside sphinx.conf? Something like below

  type = mysql
  sql_host = testHost
  sql_user = test
  sql_pass = <%= D.decrypt("encrypted password") %> // Ruby CODE
  sql_db = {{database_name}}
  sql_query_pre = SET TIME_ZONE = '+0:00'
  sql_query_pre = SET SESSION group_concat_max_len = 32768
  sql_query_pre = SET NAMES utf8

Yes, it's possible, just add


or another path to the ruby binary depending on your OS and ruby package. Then all below the 1st line is considered a ruby script which can render Sphinx config dynamically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.