Suppose you have:
Payment API
and different environments have different backend configuration:
DEV → https://dev-payment.example.com
TEST → https://test-payment.example.com
PROD → https://payment.example.com
You don’t want to hardcode these URLs inside every API proxy.
How would you design this using Apigee?
Explain:
Would you use a KVM?
What would you store in the KVM?
How would you retrieve the value during runtime?
Would you use an encrypted KVM? Why?
Where would you create environment-specific values?
What would you do if the KVM value is missing?
Answer :
Yes, I would use an environment-scoped KVM because the backend configuration is different between DEV, TEST, and PROD, while I want to keep the API proxy bundle environment-independent.
For example, I could create a KVM called payment-config.
In DEV:
KVM: payment-config
Key: backend-host
Value: dev-payment.example.com
In TEST:
KVM: payment-config
Key: backend-host
Value: test-payment.example.com
In PROD:
KVM: payment-config
Key: backend-host
Value: payment.example.com
This allows me to deploy the same proxy bundle across environments without hardcoding environment-specific values.
To retrieve the value at runtime, I would use the KeyValueMapOperations policy and perform a Get operation using the KVM name and key.
I would use an encrypted KVM when the stored value is sensitive, such as credentials, secrets, or other confidential configuration. For non-sensitive values such as backend hostnames, an encrypted KVM isn’t necessary.
The KVM itself would be configured at the appropriate environment scope, so each environment can have its own value while the proxy remains unchanged.
If the KVM value is missing, I would first verify the KVM name, key name, scope, and environment configuration. I would also check whether the expected key/value exists.
If the value is mandatory for processing the request, I would fail the request with a controlled fault rather than allowing the request to continue with an invalid or empty configuration, and I would log the configuration issue for troubleshooting.
Top comments (0)