<p>If you use this, it should work:</p>

<pre><code>\rias\scout\ScoutIndex::create(getenv('SCOUT_INDICES'))
</code></pre>

CC BY-SA 4.0
2020-04-09T04:49:04.200Z
2020-04-09T04:49:04.200Z
Brad Bell
<p>I was wondering if it was possible to add .env variable for the indices area in the scout.php file?</p>

<p>I added this to my .env file</p>

<pre><code>SCOUT_INDICES = "search_SCOUT_DEV"
</code></pre>

<p>Then this to my scout.php</p>

<pre><code>\rias\scout\ScoutIndex::create('getenv(varname:’SCOUT_INDICES’)”)
</code></pre>

<p>To replace </p>

<pre><code>\rias\scout\ScoutIndex::create('search_SCOUT')
</code></pre>

<p>Which is my Prod indices. It did not work. </p>

CC BY-SA 4.0
2020-04-08T21:04:59.020Z
Try: `\rias\scout\ScoutIndex::create(getenv('SCOUT_INDICES'))`
Brad Bell
CC BY-SA 4.0
2020-04-08T21:34:57.097Z
Thank YOU!!! That Worked!
JBrew30
<craft3><plugin-craftcommerce>
Environmental variables for Scout plugin in scout.php file
# Environmental variables for Scout plugin in scout.php file

(Asked by: username_0 on 2020-04-08)

I was wondering if it was possible to add .env variable for the indices area in the scout.php file?
I added this to my .env file
SCOUT_INDICES = "search_SCOUT_DEV"

Then this to my scout.php
\rias\scout\ScoutIndex::create('getenv(varname:’SCOUT_INDICES’)”)

To replace 
\rias\scout\ScoutIndex::create('search_SCOUT')

Which is my Prod indices. It did not work.

**Tags:** craft3, plugin-craftcommerce

> **Comments:**
> **username_1**: Try: `\rias\scout\ScoutIndex::create(getenv('SCOUT_INDICES'))`  
> **username_0**: Thank YOU!!! That Worked!  

---

## 1 answers

### Answer by username_1 on 2020-04-09. Score: 2 | Accepted answer

If you use this, it should work:
\rias\scout\ScoutIndex::create(getenv('SCOUT_INDICES'))


---

