KPS stands for Key Property Store is a collection of data stored in table structure referenced by policies running on Oracle API Gateway instance. KPS data can be stored in three different ways:
- Embedded Apache Cassandra database
- Relational SQL Database
- JSON File System.
In this blog post I am going to discuss about configuring kps using json file system and how to access these kps collection in OAG policies.
In my scenario, I have used kps as key-value pair to store the environment properties like hostname, port, URI etc. as shown below:
These values changes for different environments like prod or non-prod.
Steps to configure KPS
- Open oag policy studio -> right click on Key Property Stores and select Add KPS Collection
- Create new kps collection with name "Settings"
- Right click on Settings KPS collection and select Add Table
- Create table with name "Properties" and create structure as below
- deploy the configuration.
Edit the values of KPS
- Open node manager console -> https://host:port/8090
- Go to settings tab -> Key Property Stores as shown below
- Select table and add new entry or you can edit the value of existing record. you can not edit the column marked as a primary key i.e. in this case you cannot edit the value of column key.
- When you create the entry schema json file is automatically created at this location i.e. OAG-220.127.116.11.0/apigateway/groups/group-3/instance-1/conf/kps/file with file as settings_properties.json.
- Now you can edit this file also to add or modify the values in kps.
- you need to restart the oag instance to reflect the updated values.
Access kps collection in OAG policies
KPS data can be access in oag policies by using the selectors as below:
for example: to access value of OAMHOST the selector expression is as follows