Is it possible to set the ExpiryTimeInSecs value from a variable for a KeyValueMapOperations policy?

Hi ,

For testing purpose I need to set the ExpiryTimeInSecs for KeyValueMapOperations policy to a lesser value in dev and Increase the same value in prod. Can I dynamically set the value of ExpiryTimeInSecs using a variable ?

0 1 75
1 REPLY 1

Unfortunately ... the ExpiryTmeInSecs element does not accept a dynamic value, a reference to a variable. 

It takes only a fixed value.  So... the way to do what you want, would be to templatize the policy template and store that in your code repo... and then in the CI/CD pipeline, you would replace the placeholders. What I mean is, store in your code repo, this kind of thing: 

<KeyValueMapOperations name='KVM-1'>
  <Scope>environment</Scope>
  <ExpiryTimeInSecs>@@PLACEHOLDER@@</ExpiryTimeInSecs>
  <Get assignTo='my_variable_to_set'>
    <Key>
      <Parameter ref='variable.containing.key'/>
    </Key>
  </Get>
</KeyValueMapOperations>

 ...and then use the maven deploy plugin to replace that value with the correct thing for the environment.