Closed SteveRedka closed 5 years ago
I know it's been a couple of months, but I've not forgotten about this issue. Hoping to get to it soon, it's just that it might require some behaviour changes for Riddle rather than TS.
Finally making some time to look into this, and wishing I'd responded far more quickly.
Firstly: did you find a way of making this work?
My initial investigation suggested that Rails itself is not set up to use environment variables like this in the config/database.yml
file, so as a workaround I added sql_host: $SQL_HOST
to my config/thinking_sphinx.yml
file in the appropriate environment. This ensured the Sphinx configuration file was generated accordingly.
However, even when I invoke indexing directly with Sphinx (e.g. SQL_USER=root indexer --config config/development.sphinx.conf --rotate --all
) it doesn't work:
ERROR: index 'article_core': sql_connect: Access denied for user '$SQL_USER'@'localhost' (using password: NO)
Did you find the behaviour was different? And if so, which version of Sphinx are you using?
Yes, I made it work. I just forgot to add a shebang string to make it a bash executable.
So, now sphinx.conf
looks like this:
#!/bin/bash
printf "
...
sql_user = $MYSQL_USER
sql_pass = $MYSQL_PASSWORD
...
"
Ah, and you have to make that change after every regeneration of the Sphinx configuration file?
I'm going to close this issue as it's been dormant for a while. Certainly if there's more to discuss, chime in anyway!
In my
sphinx.conf
file I have this:And it is a recommended way to handle environment variables by sphinx documentation.
When I run tasks through sphinx alone, it works fine. However, when I run it through app, it passes variables as plain text: