I have another question where I needed to add another target database to my sync in unicorn. However I only need the patch to take affect in my production environment since my local errors out on the unicorn sync since I don't need the target database on local. So my DBs are web and web_uk but they are only on production environments. Is there any way I can get around the error on local environments?
1 Answer
You can add role on your configuration into your patch config.
For example I created a patch config for setting up site definition for prod environment.
<site name="website1"
env:require="PROD"
role:require="ContentDelivery"
patch:before="site[@name='website']"
hostName="test.com"
targetHostName="test.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content"
startItem="/home"
domain="extranet"
allowDebug="false"
cacheHtml="false"
htmlCacheSize="10MB"
disableClientData="false"
contentLanguage="en"
content="master"
language="en"
/>
I think this example may help to understand adding patch configuration according to environment.
In web.config we need to add these settings as well
<!-- SUPPORTED ENVIRONMENTS
Specify the environment that you want this server to perform. A server can perform single environment. The supported environments are:
LOCAL
DEV
TEST
STAGE
PROD
Default value: Local
-->
<add key="env:define" value="PROD" />