Specifying Custom Configuration Parameters to Pass to Functions

Find out how to specify custom configuration parameters to pass to running functions with OCI Functions.

For prerequisites and more information, see Passing Custom Configuration Parameters to Functions.

    1. Sign in to the Console as a functions developer.
    2. Open the navigation menu and click Developer Services. Under Functions, click Applications.
    3. Select the region you're using with OCI Functions.

      We recommend that you use the same region as the Docker registry that's specified in the Fn Project CLI context. See Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure.

    4. Select the compartment specified in the Fn Project CLI context. See Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure.

      The Applications page shows the applications defined in the compartment.

    5. Click the name of the application containing functions to which you want to pass custom configuration parameters:

      • To pass one or more custom configuration parameters to every function in the application, click Configuration to display the Configuration page for the application.

      • To pass one or more custom configuration parameters to a particular function, click the function's name and then click Configuration to see the Configuration page for the function.

    6. In the Configuration page, specify the following details for the first custom configuration parameter:

      • Key: The name of the custom configuration parameter. The name must only contain alphanumeric characters and underscores, and must not start with a number. For example, username
      • Value: A value for the custom configuration parameter. The value must only contain printable Unicode characters. For example, jdoe
    7. Click the plus button to save the new custom configuration parameter.

      OCI Functions combines the key-value pairs for all the custom configuration parameters (both application-wide and function-specific) in the application into a single, serially encoded configuration object with a maximum allowable size of 4 Kb. You can't save the new custom configuration parameter if the size of the serially encoded configuration object would be greater than 4 Kb.

    8. (Optional) Enter other custom configuration parameters as required.
  • Tip

    From time to time, new versions of the Fn Project CLI are released. We recommend you regularly check that the latest version is installed. For more information, see Steps to upgrade the Fn Project CLI.

    To specify custom configuration parameters to pass to functions using the Fn Project CLI:

    1. Log in to your development environment as a functions developer and open a terminal window.

    2. To specify one or more custom configuration parameters to pass to every function in an existing application, enter:

      fn config app <app-name> <key> <value>

      where:

      • <app-name> is the name of the application containing the functions to which you want to pass the custom configuration parameter.
      • <key> is the name of the custom configuration parameter. The name must only contain alphanumeric characters and underscores, and must not start with a number.
      • <value> is the value to give to the custom configuration parameter. The value must only contain printable Unicode characters.

      For example:

      fn config app acmeapp username jdoe

      Note the following:

      • You can also define application-wide custom configuration parameters when you create a new application using the fn create app command.
      • OCI Functions combines the key-value pairs for all the custom configuration parameters (both application-wide and function-specific) in the application into a single, serially-encoded configuration object with a maximum allowable size of 4Kb.
    3. To specify one or more custom configuration parameters to pass to a particular function, enter:

      fn config function <app-name> <function-name> <key> <value>

      where:

      • <app-name> is the name of the application containing the function to which you want to pass the custom configuration parameter.
      • <function-name> is the name of the function to which to pass the custom configuration parameter.
      • <key> is the name of the custom configuration parameter. The name must only contain alphanumeric characters and underscores, and must not start with a number.
      • <value> is the value to give to the custom configuration parameter. The value must only contain printable Unicode characters.

      For example:

      fn config function acmeapp acme-func username jdoe

      Note the following:

      • You can also define function-specific custom configuration parameters when you create a new function using the fn create function command.
      • OCI Functions combines the key-value pairs for all the custom configuration parameters (both application-wide and function-specific) in the application into a single, serially-encoded configuration object with a maximum allowable size of 4Kb.
  • Run these API operations to define custom configuration parameters: