Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get config data from local.properties to impex?

Is it possible to get a value from the environment variables defined at local.properties configuration file and access it via the impex file?

Ex.

$someMacro=<some variable from config>

Thank you!

like image 811
user1865775 Avatar asked Feb 08 '16 09:02

user1865775


1 Answers

You can add this to your impex:

# Import config properties into impex macros
UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true]

All your configurations from local.properties, etc. are now loaded and can be used via $config- prefix, say for example:

local.properties

your.config.property=322

So your impex would look something like:

# Import config properties into impex macros
UPDATE GenericItem[processor=de.hybris.platform.commerceservices.impex.impl.ConfigPropertyImportProcessor];pk[unique=true]

$variable=$config-your.config.property

INSERT_UPDATE SampleItem;code[unique=true];name
;sample1;$variable

# OR you can just directly use the config macro
INSERT_UPDATE SampleItem;code[unique=true];name
;sample1;$config-your.config.property

Hope this works for you.

EDIT: Please also note that if there was no such property found, the value stored on the sample above shall be exactly: $config-your.config.property.

like image 55
Atsusa Kai Avatar answered Sep 23 '22 21:09

Atsusa Kai