Edit in GitHubLog an issue

App Builder app Custom Configuration

Developers of distributable App Builder apps can define configuration options for users to set at deploy time.

Defining custom configuration options

Custom configuration can be defined via the configSchema property.

app.config.yaml

Copied to your clipboard
1application:
2 <application config>
3extensions:
4 <extension configs>
5configSchema: # This is a top-level property and is global to the app and all extensions
6 title: 'the title'
7 description: 'the description'
8 properties:
9 - title: 'Slack Webhook'
10 type: 'string'
11 description: 'Please provide the webhook used by this application. Configure in slack.com'
12 envKey: 'SLACK_WEBHOOK'

Usage

The envKey property of a custom configuration option maps to the environment variable name in the app.

Runtime action

To use custom configuration in a Runtime action, map the envKey value for the desired variable to the inputs of the Runtime action, then access values via params.<envKey> in the action code.

Example

app.config.yaml

Copied to your clipboard
1configSchema:
2 title: 'the title'
3 description: 'the description'
4 properties:
5 - title: 'enable caching'
6 type: 'boolean'
7 envKey: 'IS_CACHING_ENABLED' <--- Environment variable name
8application:
9 actions: actions
10 web: web-src
11 runtimeManifest:
12 packages:
13 dx-excshell-1:
14 license: Apache-2.0
15 actions:
16 generic:
17 function: actions/generic/index.js
18 web: 'yes'
19 runtime: nodejs:16
20 inputs:
21 LOG_LEVEL: debug
22 IS_CACHING_ENABLED: $IS_CACHING_ENABLED <--- Mapped environment variable
23 annotations:
24 require-adobe-auth: true
25 final: true
26 code-download: true

Action code

Copied to your clipboard
1async function main (params) {
2 if (params.IS_CACHING_ENABLED) {
3 enableCache()
4 }
5}
6
7exports.main = main

Web application

To use custom configuration in the web application, values can be accessed directly via process.env.<envKey>.

Example

app.config.yaml

Copied to your clipboard
1configSchema:
2 title: 'Configurable Web App'
3 description: 'Web application that can be configured.'
4 properties:
5 - title: 'Frontend background color'
6 type: string
7 description: 'Please provide the background color for your frontend'
8 enum:
9 - blue-400
10 - celery-400
11 - indigo-400
12 envKey: FRONTEND_BACKGROUND_COLOR <--- Environment variable name
13application:
14 web: web-src

Component.js

Copied to your clipboard
<View backgroundColor={process.env.FRONTEND_BACKGROUND_COLOR}></View>

Custom Configuration Types

Text field

Screenshot of text field

Copied to your clipboard
1configSchema:
2 title: 'Configure your application'
3 description: 'Set configurable variables for this Slack application'
4 properties:
5 - title: 'Slack Webhook'
6 type: 'string'
7 description: 'Please provide the webhook used by this application. Configure in slack.com'
8 envKey: 'SLACK_WEBHOOK'
9 default: 'https://slack.com/webhook'

Checkbox

Screenshot of checkbox

Copied to your clipboard
1configSchema:
2 title: 'Configure your application'
3 description: 'Customize this application to meet your needs.'
4 properties:
5 - title: 'Enable caching'
6 description: 'Determines whether or not the app caches.'
7 type: 'boolean'
8 envKey: 'IS_CACHING_ENABLED'

Screenshot of dropdown

Copied to your clipboard
1configSchema:
2 title: 'Configurable Web App'
3 description: 'Web application that can be configured.'
4 properties:
5 - title: 'Frontend background color'
6 type: string
7 description: 'Please provide the background color for your frontend'
8 enum:
9 - blue-400
10 - celery-400
11 - indigo-400
12 envKey: FRONTEND_BACKGROUND_COLOR

Secret

Secret screenshot pending bug fix

Copied to your clipboard
1configSchema:
2 title: 'the title'
3 description: 'the description'
4 properties:
5 - title: 'aws secret key'
6 type: 'string'
7 secret: true
8 envKey: 'AWS_SECRET'

Multiple configuration options

Screenshot of Multiple Configuration

Copied to your clipboard
1configSchema:
2 title: 'Configurable Web App'
3 description: 'Web application that can be configured.'
4 properties:
5 - title: 'Frontend background color'
6 type: string
7 description: 'Please provide the background color for your frontend'
8 enum:
9 - blue-400
10 - celery-400
11 - indigo-400
12 envKey: FRONTEND_BACKGROUND_COLOR
13 - title: 'Enable caching'
14 description: 'Determines whether or not the app caches.'
15 type: 'boolean'
16 envKey: 'IS_CACHING_ENABLED'
17 - title: 'Slack Webhook'
18 type: 'string'
19 description: 'Please provide the webhook used by this application. Configure in slack.com'
20 envKey: 'SLACK_WEBHOOK'
21 default: 'https://slack.com/webhook'
22
23
24export const _frontmatter = {}
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.