Skip to content

Instantly share code, notes, and snippets.

@kevinswiber
Last active December 7, 2017 23:21
Show Gist options
  • Save kevinswiber/2feaa30be3bd9e7199200ac16d6fbff9 to your computer and use it in GitHub Desktop.
Save kevinswiber/2feaa30be3bd9e7199200ac16d6fbff9 to your computer and use it in GitHub Desktop.
Using Jsonnet with Express Gateway configuration
/*
Run:
$ HTTPBIN_URL=https://httpbin.org jsonnet -V HTTPBIN_URL \
-o ./config/gateway.config.json \
./config/gateway.config.jsonnet
*/
{
http: {
port: 8080
},
admin: {
port: 9876,
hostname: "localhost"
},
apiEndpoints: {
api: {
host: "localhost",
paths: "/ip"
}
},
serviceEndpoints: {
httpbin: {
url: std.extVar("HTTPBIN_URL")
}
},
policies: [
"proxy"
],
pipelines: {
default: {
apiEndpoints: [
"api"
],
policies: [
{
proxy: [
{
action: {
serviceEndpoint: "httpbin",
changeOrigin: true
}
}
]
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment