support for command line environment variables #4377
Unanswered
SachinGhumbre
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We use inso generate command to generate kong configuration from openapi specifications. To achieve multiple environment deployments using the same openapi yaml file, there is a need to have environment variables to be passed at command line. Example given below:
my-orders.yaml
openapi: 3.0.0
tags:
info:
title: "OrdersAPI" # service name in kong
version: "1.0"
servers:
variables:
HOSTNAME:
default: localhost:8443
enum:
- "QA-SERVER:8443"
- "PROD-SERVER:8443"
When I run "inso generate config orders.yml --type declarative > kong.yaml", it will generate corresponding kong configuration file for orders API as mentioned below:
_format_version: "1.1"
services:
protocol: https
host: localhost
port: 8443
path: /api/v1.0/orders
plugins:
tags:
If you notice, host value is taken from default value of HOSTNAME variable from orders.yml. What if I want to generate the kong configuration of orders API for PreProd or Prod ? It will not work as per current design.
So if we can have environment variable as key=value pair at command line then we can achieve multi env deployments.
For example :
inso generate config orders.yml --type declarative > kong.yaml ** --env-var HOSTNAME=PROD-SERVER:8443**
this should create kong.yaml as per below:
_format_version: "1.1"
services:
protocol: https
host: PROD-SERVER
port: 8443
path: /api/v1.0/orders
plugins:
tags:
This change will indeed help in implementation of CICD.
All reactions