From e295c41243636896de33bd89a5a9bd13d477b86f Mon Sep 17 00:00:00 2001 From: Peter Deltchev Date: Sun, 17 Jan 2016 05:22:14 -0800 Subject: [PATCH] #1: Made Elasticsearch hosts configurable in an environment variable. --- config/elasticsearch.php | 7 ++++--- .../migrations/2016_01_14_021607_setup_elasticsearch.php | 1 - resources/environments/.env.example | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/elasticsearch.php b/config/elasticsearch.php index faa27549..182f2a52 100644 --- a/config/elasticsearch.php +++ b/config/elasticsearch.php @@ -29,13 +29,14 @@ return [ * instances. * * This is the only configuration value that is mandatory. + * + * If set in an environment variable, this should be a comma-separated + * list of hostnames. Port numbers are optional; 9200 is the default. * * @see https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html#_host_configuration */ - 'hosts' => [ - 'localhost:9200' - ], + 'hosts' => explode(',', env('ELASTICSEARCH_HOSTS', 'localhost:9200')), /** * SSL diff --git a/database/migrations/2016_01_14_021607_setup_elasticsearch.php b/database/migrations/2016_01_14_021607_setup_elasticsearch.php index 33e48dfc..b4980838 100644 --- a/database/migrations/2016_01_14_021607_setup_elasticsearch.php +++ b/database/migrations/2016_01_14_021607_setup_elasticsearch.php @@ -19,7 +19,6 @@ */ use Illuminate\Database\Migrations\Migration; -use Poniverse\Ponyfm\Console\Commands\RebuildSearchIndex; class SetupElasticsearch extends Migration { diff --git a/resources/environments/.env.example b/resources/environments/.env.example index 663e44a8..5e0d4e6d 100644 --- a/resources/environments/.env.example +++ b/resources/environments/.env.example @@ -8,6 +8,8 @@ DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret +ELASTICSEARCH_HOSTS=localhost + SESSION_HTTPS_ONLY=false QUEUE_DRIVER=sync