0

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
 }
loganathan
  • 240
  • 2
  • 13

1 Answers1

0

Yes, it's possible, just add

#!/usr/bin/ruby

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.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47