What is the recommended place to configure runtime values ?

Not applicable

I have some run-time values inside the policies like Quota allocation, Cors Max Age Allocation and etc. What is recommended place to configure these as variables ? I see at product level something called Custom Attributes. I think that would be only applicable for proxies which is under that product. Any other way at Environment level. I see KVM, but looks like KVM is mostly for Secure Keys. Can you guide the best way ?

0 3 143
3 REPLIES 3

@Kumaresan Sithambaram

I would recommend Custom Attributes. Since all the proxies will be grouped as Products and then Dev Apps uses products, it is better to configure them there so that they are uniquely set for each Product.

For example, you could have a proxy with 10 request a day for Product1 and 20 requests a day for Product2.

While creating new products, you can use the same custom attributes name with 10 and 20 as values for each product. Depending on the product that is calling the proxy, the values are picked and used on a runtime basis. All these custom attributes are available as Flow Variables once you execute the VerifyAPIKey policy or Verify Access Token in Oauth policy

You can use KVM as well. It is not recommended to use KVM if you want to store sensitive info (PII, etc). Please read the usage notes

Hope this helps.

@Sai Saran Vaidyanathan

Thank you for Quick Reply !!

Followed on this topic. How to use KVMs configuration ? I have configured "Keys" under that,

"key1=value1"

"key2=value2"

In KVM Policy at ProxyEndpoint Preflow

  <Get assignTo="key1" index="1">
        <Key>
            <Parameter>Keys.key1</Parameter>
        </Key>
    </Get>

I would expect when access context.getVariable("key1") have "value1". But, it does not.. what's wrong i am here ? Thanks a lot for your help.

You can create KVM using UI under Environment Configurations or using Mgmt API

Lets say you created the following KVM

2904-screen-shot-2016-06-10-at-25022-pm.png

To retrieve this, you need to configure a KVM policy in your flow

The policy for the above will look like this

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="getValueFromKVM" mapIdentifier="testKVM">
    <DisplayName>getValueFromKVM</DisplayName>
    <Properties/>
    <ExclusiveCache>false</ExclusiveCache>
    <ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
    <Get assignTo="value1" index="1">
        <Key>
            <Parameter>key1</Parameter>
        </Key>
    </Get>
    <Scope>environment</Scope>
</KeyValueMapOperations>

NOTE: mapIdentifier is the name of the KVM and assignTo is the variable to which the value from the KVM will be set.

Hope this helps. Please go through the documentation for further info.