Closed tonestrike closed 7 years ago
What about conditionally setting a var depending on NODE_ENV
... something like:
const subdomainVal = process.env.NODE_ENV === 'development'
? 'example-local'
: 'example-stage';
app.use(subdomain(subdomainVal, router));
Obv if you have more options a ternary wouldn't be the best - but you get the idea :)
That is basically exactly what I ended up doing, except I just set dotenv values for the subdomains themselves. Sometimes the obvious solution comes slowly.
So depending on my environment, the subdomain off an app has a suffix attached like
example
example-local
example-stage
. I have triedapp.use(subdomain('example*', router))*
but that does not work. Any suggestions?