简体   繁体   English

如何在 Gentics Mesh 中播种模式

[英]How to seed schemas in Gentics Mesh

I'm working with a team of developers, and we need to be able to stand-up a Mesh instance with all the predefined schemas on anyone's laptop.我正在与一个开发团队合作,我们需要能够在任何人的笔记本电脑上建立一个具有所有预定义模式的 Mesh 实例。

I'd like to be able to create schemas if they don't exist, based on a collection of JSON files.如果模式不存在,我希望能够基于 JSON 文件的集合创建模式。

I've started a Gentics Mesh plugin that will look for the schema files, then add them via the MeshRestClient.我已经启动了一个 Gentics Mesh 插件,它将查找模式文件,然后通过 MeshRestClient 添加它们。

Is that a good approach?这是一个好方法吗?

I'm following the HelloWorld example here to get started -我在这里按照 HelloWorld 示例开始 -
https://github.com/gentics/mesh-plugin-examples/blob/master/hello-world-plugin/ https://github.com/gentics/mesh-plugin-examples/blob/master/hello-world-plugin/

So I built a "mesh-seeding-plugin", and it worked as expected.所以我构建了一个“mesh-seeding-plugin”,它按预期工作。

It uses a config file to get the list of json schemas to load up, then when the plugin initializes, it created the schemas if they don't exist.它使用配置文件获取要加载的 json 模式列表,然后在插件初始化时,如果模式不存在,它会创建模式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM