如何从local.properties获取配置数据到impex? [英] How to get config data from local.properties to impex?
问题描述
是否可以从在local.properties配置文件中定义的环境变量中获取值并通过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?
例如.
$someMacro=<some variable from config>
谢谢!
推荐答案
您可以将其添加到您的impex中:
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]
所有来自local.properties等的配置现在都已加载,可以通过$config-
前缀使用,例如:
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
希望这对您有用.
也请注意,如果没有找到这样的属性,则上面示例中存储的值应为:$config-your.config.property
.
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
.
这篇关于如何从local.properties获取配置数据到impex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!