PAYLOAD_GET_CONFIG - Retrieve a permanent payload configuration option

PAYLOAD_SET_CONFIG - Set a permanent payload configuration option

PAYLOAD_DEL_CONFIG - Delete a permanent payload configuration option

When to use them

If your payload allows the user to set configuration options, using the PAYLOAD_XYZ_CONFIG commands offers a convenient way to save these options. Configuration options saved this way will persist across firmware upgrades.

Syntax

  PAYLOAD_GET_CONFIG [payload name] [option]
  

payload name

Simple name of the payload. This must not contain spaces, and should be unique. The payload name is used to distinguish between different payloads using the same variable name.

option

Option name to fetch.

  PAYLOAD_SET_CONFIG [payload name] [option] [value]
  

payload name

Simple name of the payload. This must not contain spaces, and should be unique. The payload name is used to distinguish between different payloads using the same variable name.

option

Option name to set

value

Value to save

  PAYLOAD_DEL_CONFIG [payload name] [option]
  

payload name

Simple name of the payload. This must not contain spaces, and should be unique. The payload name is used to distinguish between different payloads using the same variable name.

option

Option name to delete.

Results

PAYLOAD_GET_CONFIG returns the option value on the output of the command, and sets a return code of 0 on success and non-zero on failure.

PAYLOAD_SET_CONFIG sets a return code of 0 on success and non-zero on failure. The most common cause for a failure to set a value is an illegal payload or option name.

PAYLOAD_DEL_CONFIG will never return an error - if a config value is not found, it is ignored.

Examples

  PAYLOAD_SET_CONFIG demopayload host "1.2.3.4"
  
  # ignore an error, we don't care
__config_host=$(PAYLOAD_GET_CONFIG demopayload host)
__host=$(TEXT_PICKER "Hostname" "${__config_host}") || exit 0