Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In the Onesait Platform, there is you have the posibility possibility to create our your own custom configurations. Lets In this example, we will see how to do so create a custom configuration and how to use them it in the FlowEngine. This will allow us allows you to have everything related with to configuration centraliced just in one placecentralized in a single point.

Instructions

  1. Create a custom configuration

...

  1. :

...

    1. In the menu, go to “Dev Tools” → “Centralized configuration”.

      Image Modified

    2. Create a custom configuration:

      Image Modified


      and fill it with the values you need, following a yaml format:

      Image Modified

  1. Read

...

  1. the configuration from the FlowEngine

...

  1. : To read the configuration

...

  1. , use the Onesait

...

  1. Platform Management API. The FlowEngine already has a node

...

  1. that will facilitate the calls to that API, and you only have to select

...

  1. the operation

...

  1. that you want to execute. You are going to create a subflow that will be in charge of reloading the configuration to global variables

...

  1. within your flows.

    1. Create a subflow:

      Image Modified

      This will open a new tab.

...

    1. If you double

...

    1. click on it,

...

    1. you can change

...

    1. the name to “Load Config”.

      After

...

    1. this, you are going to define

...

    1. an input and

...

    1. an output:

      Image Modified

...

    1. These represent the input and output pins of

...

    1. your subflow node.

    2. Get a valid

...

    1. OAuth token:

...

    1. You are going to use an “http request” call to your IM to get it. For more information

...

    1. related to the Identity Manager, take a look at how to use

...

    1. OAuth2 tokens in Platform

      First

...

    1. , you need to set the request headers and body

...

    1. , using a “function” node

...

    1. like the following:

      Image Modified

...

    1. Next, create an “http request” node with the call to the IM:

      Image Modified

      In this specific case

...

    1. , you are

...

    1. using KeyCloak as

...

    1. IM. The

...

    1. username and password in the authentication are “onesaitplatform” in both cases.

...

    1. After this, you can parse

...

    1. the response into a “function" node and get

...

    1. your OAuth token ready to use in the next call:

      Image Modified

    2. Get the configuration

...

    1. :

      Once

...

    1. you have

...

    1. the OAuth token,

...

    1. you can retrieve the configuration

...

    1. using

...

    1. your “onesaitplatform-management-Rest-API-

...

    1. invoker” node. Add

...

    1. this node

...

    1. from the palette to the subflow and double click on it to edit it:

      1. Select “Configuration management service“

...

      1. as the API.

        Image Modified

      2. Select “getByIdentificationUsingGET” as the

...

      1. operation.

        Image Modified

      2. Fill in the

...

      1. required fields of the request. These parameters correspond to the values defined in the configuration that you created in step 1:

        Image Modified

    1. The “onesaitplatform-management-Rest-API-

...

    1. invoker” node has

...

    1. several outputs. By hovering the cursor over each one,

...

    1. you will get a tooltip with the description of each

...

    1. one. For simplicity, the top output is the one that will contain the correct answer, and the rest are different types of errors.

      Image Modified

...


    1. Add a “function” node

...

    1. in which you can process errors if necessary.

  1. Load

...

  1. configuration into global variables.

    Now

...

  1. you are going to process the response from the API

...

  1. to convert it into an object

...

  1. that is

...

  1. easier to use. The

...

  1. management API invocation node will return the configuration

...

  1. in the message,

...

  1. specifically in the

...

  1. “msg.payload.yml

...

  1. " field. The next step

...

  1. is to parse

...

  1. the yaml

...

  1. intto a

...

  1. JSON object.
    To do

...

  1. this,

...

  1. add a

...

  1. “yaml" node to the subflow and

...

  1. indicate the field to parse:

    Image Modified


    The parsed configuration should look like this:

    Image Modified


    Finally, in a “function” node

...

  1. , read the configuration object and

...

  1. create the global variables you need:

    Image Modified

  2. Deploy the changes by clicking on the

...

  1. “deploy” button:

    Image Modified


  2. Use the subflow and test the results.

...

  1. Simply create a simple flow

...

  1. that executes the “Load

...

  1. Config” subflow and a “function” node

...

  1. that reads all the global variables to display them:

 

...

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@9e1
showSpacefalse
sortmodified
showSpacetypefalsepage
reversetrue
typelabelspageflowengine
cqllabel = "flowengine" and type = "page" and space = "OP"
labelsflowengine
Page Properties
hiddentrue
Incidencias similares