Last active
December 7, 2017 23:21
-
-
Save kevinswiber/2feaa30be3bd9e7199200ac16d6fbff9 to your computer and use it in GitHub Desktop.
Using Jsonnet with Express Gateway configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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