Kong now allows you to import a certificate object from environment variables. What are the steps to implement this?
How to import a certificate object from environment variables to Kong by using the secret management function
How do I import a certificate object into Kong from environment variables using the secrets management function?
Export the certificate and key as environment variables (e.g. MY_SECRET_CERT and MY_SECRET_KEY), then reference them in the certificate object’s cert and key fields using {vault://env/<name>} syntax — for example, cert: '{vault://env/my-secret-cert}' — either in declarative config or in Kong Manager. Restart Kong afterward.
Steps
-
Export your certificate and key as environment variables.
Here we use
MY_SECRET_CERTfor the public certificate andMY_SECRET_KEYfor the private key.export MY_SECRET_CERT='-----BEGIN CERTIFICATE----- <YOUR PUBLIC CERTIFICATE CONTENT> -----END CERTIFICATE-----' export MY_SECRET_KEY='-----BEGIN PRIVATE KEY----- <YOUR PRIVATE KEY CONTENT> -----END PRIVATE KEY-----' -
Reference
MY_SECRET_CERTandMY_SECRET_KEYto create the certificate object in Kong.-
If you use a declarative configuration YAML file, create the certificate object like this:
_format_version: "3.0" _transform: true certificates: - id: b0dbe8fd-e5e6-414a-a0dc-0160665620ab cert: '{vault://env/my-secret-cert}' key: '{vault://env/my-secret-key}' -
If you use Kong Manager, create the certificate object as shown below:
-
-
Restart Kong.
kong restart