--- title: Config Template --- ## What is Config Template? There are many scenarios to need users to provide structured data which is a config. `Config Template` could define the schema and the structure of the config data. KubeVela could base the `Config Template` help users to create a valid config. The config data save as a Secret default, but you also could generate resources of any type by defining the template. Even, you can define the extend writer to write the config data to the Nacos server. ## Config Template Specification `Config Template` defined with the CUE file. The schema of the specification: ```cue metadata: { name: string alias?: string description?: string scope: "project" | "system" sensitive: bool } template: { parameter: {...} output?: #Secret outputs?: {#AnyResources} nacos?: { // The endpoint can not references the parameter. endpoint: { // Users must create a config base the nacos-server template firstly. name: string } format: "json" | "yaml" | "properties" | "toml" // could references the parameter metadata: { dataId: string group: string appName: string namespaceId: string tenant: string tag: string } content: {...} } } ``` ### Metadata * `metadata.name` This is required. Specify the name of the template. * `metadata.alias` Specify the alias of the template. * `metadata.description` Specify the description of the template. * `metadata.scope` Specify the scope of the config created by this template. In VelaUX, the template belonging to the project scope means this template could be used to create the config in the project. If created in the system, this config could be shared with all projects. * `metadata.sensitive` Is it sensitive the config created by this template? If the config is sensitive, it can not be read directly and could only mount the Secret. ### Template * `template.parameter` Specify the parameters of the config. KubeVela will generate the schema by this definition and validate the user's input. * `template.output` This is not required. You could specify if you want to customize the data structure of the Secret. * `template.outputs` This is not required. You could specify any resources that you want to generate by this config. * `template.nacos` This is not required. You could specify the Nacos config metadata if you want to write the config data to the Nacos server. `template.nacos.name` This is the name of the config created by the built-in template `nacos-server`. ## Config Template Management * List the Config Templates ```bash vela config-template list ``` * Create a Config Template ```bash vela config-template apply -f example.cue ``` * Show the schema and document of the Config Template ```bash vela config-template show