Skip to main content
Deployment options: WSO2 Cloud

Use Configuration Form for Managing Configurations

WSO2 Developer Platform allows you to inject values for your configurations through a rich user interface.

info
  • This feature is currently only available for Ballerina, Go, Python, Java, .NET, NodeJs, Ruby and PHP build presets (excluding Web Applications).
  • The configuration form is supported starting from component.yaml v1.2.

You can configure configurations in the component.yaml. Based on these configurations, a form is displayed in the WSO2 Developer Platform console. Users can define environment variables and file keys under the configurations section in the component.yaml.

Refer to the following examples for more details.

ConfigurationTypeRequiredDescription
envObject[ ]OptionalAn array of environment variable configurations.
fileObject[ ]OptionalAn array of file configurations.

Environment Variables​

ConfigurationTypeRequiredDescription
nameStringRequiredA unique name for the environment variable, starting with a letter or an underscore, and containing only letters, numbers, or underscores.
valueFromObjectRequiredThe source of the configuration form.
configurations:
# +optional List of environment variables to be injected into the component.
env:
- name: DB_USER
# +required value source
# Allowed value sources: connectionRef, configForm
valueFrom:
# +required config form value source
configForm:
# +optional display name inside the config form, name will be shown in config form if not specified
displayName: DB User
# +optional default value is true if not specified
required: false
# +optional default value is string if not specified
# Allowed types - string, number, boolean, secret
type: string
note

Only string, boolean, number, and secret are allowed as environment variable types.

File Mount​

ConfigurationTypeRequiredDescription
mountPathStringRequiredPath that file to be mounted in the container
nameStringRequiredA unique name for the environment variable, starting with a letter or an underscore, and containing only letters, numbers, or underscores.
typeStringRequiredFile extension type. Supported types are yaml, json, and toml, and type is required
valuesObject[ ]RequiredRequired under file section. File key-values definition
configurations:
# +optional List of files to be injected into the component from config form
file:
# +required name of the file
- name: application.yaml
# +required path to mount the file at
mountPath: /src/resources
# +required file type
# Supported types - yaml, json and toml
type: yaml
# +required define keys of the file
values:
# keys of the file
# +required at least one key
- name: version
# +required value source
# Allowed value sources: connectionRef, configForm
valueFrom:
# +required config form value source
configForm:
# +optional display name inside the config form, name will be shown in config form if not specified
displayName: Version
# +optional default value is string if not specified
# Allowed types - string, number, boolean, secret, object, array
type: number
# +required if type is object or array
# define the properties of the object
properties:
# +required sub key of the object
- name: logger_name
# +optional display name inside the config form, name will be shown in config form if not specified
displayName: Logger Name
# +required sub key of the object
- name: level
# +optional display name inside the config form, name will be shown in config form if not specified
displayName: Level
# +optional define enum list for value selection
values:
- info
- debug
# keys of the file
- name: users
# +required value source
# Allowed value sources: connectionRef, configForm
valueFrom:
# +required config form value source
configForm:
# +optional display name inside the config form, name will be shown in config form if not specified
displayName: Users
# +optional default value is string if not specified
# Allowed types - string, number, boolean, secret, object, array
type: array
# +required if type is array
items:
# +optional default value is string if not specified
type: object
# +required if type is object or array
# define the properties of the object
properties:
- name: name
- name: description
required: false
- name: age
type: number
- name: address
type: object
properties:
- name: street
- name: city

General Configuration Form Definitions​

Values object​

ConfigurationTypeRequiredDescription
nameStringRequiredThe name of the file sub key
valueFromObjectRequiredConfiguration form value source definition

ValueFrom object​

ConfigurationTypeRequiredDescription
configFormObjectRequiredConfiguration form value source definition

ConfigForm object​

ConfigurationTypeRequiredDescription
displayNameStringOptionalThe display name of the defined key in the configuration form
typeStringOptionalThe type of value. Supported types are string, number, boolean, secret, object,
requiredBooleanOptionalDefine whether the value is required or not for the key. Defaults to true when not specified.
propertiesObjectOptionalRequired if type is an object. Definition for defining the sub-properties of the object
itemsObjectOptionalRequired if type is an array. Definition for defining the array

Properties object​

ConfigurationTypeRequiredDescription
nameStringRequiredThe name of the file sub key
displayNameStringOptionalThe display name of the defined key in the configuration form
typeStringOptionalThe type of value. Supported types are string, number, boolean, secret, object,
requiredBooleanOptionalDefine whether the value is required or not for the key. Defaults to true when not specified.

Items object​

ConfigurationTypeRequiredDescription
typeStringOptionalThe type of value. Supported types are string, number, boolean, secret, object,
propertiesObject[ ]OptionalRequired if type is an object. Definition for defining the sub-properties of the object
note
  • It is allowed to define nested configurations under the types object and array.
  • properties is required if the type is object and define sub-object keys under it.
  • items is required if the type is array and define array properties under it.

Once user clicks the Configure and Deploy button, defined configurtions are shown and user can inject values through the form.