process_fts_updates: Fix pgroonga search in development.

For some reason, we have the USING_PGROONGA setting on in development
right now.  I'm going to disable that in another commit to match what
we're doing in production, but we'll still want that setting to work
in development.

The problem here was that process_fts_updates only attempted to read
the USING_PGROONGA setting from a /etc/zulip/zulip.conf source, and
thus would just not be updating the index in development.
This commit is contained in:
Tim Abbott 2017-10-30 11:03:47 -07:00
parent aea33fc738
commit acb0b6ee43
1 changed files with 7 additions and 1 deletions

View File

@ -66,18 +66,24 @@ try:
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.settings'
from django.conf import settings
remote_postgres_host = settings.REMOTE_POSTGRES_HOST
USING_PGROONGA = settings.USING_PGROONGA
except ImportError as e:
# process_fts_updates also supports running locally on a remote
# postgres server; in that case, one can just connect to localhost
remote_postgres_host = ''
USING_PGROONGA = False
# Since we don't want a hard dependency on being able to access the
# Zulip settings (as we may not be running on a server that has that
# data), we determine whether we're using pgroonga using
# /etc/zulip/zulip.conf.
#
# However, we still also check the `USING_PGROONGA` variable, since
# that's all we have in development.
config_file = six.moves.configparser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")
USING_PGROONGA = config_file.has_option('machine', 'pgroonga')
if config_file.has_option('machine', 'pgroonga'):
USING_PGROONGA = True
if remote_postgres_host != '':
postgres_password = ''