Skip to content

Instantly share code, notes, and snippets.

@gkumarau
Created October 1, 2018 01:36
Show Gist options
  • Save gkumarau/3346332f745a3b6cedd4ddc834e468ac to your computer and use it in GitHub Desktop.
Save gkumarau/3346332f745a3b6cedd4ddc834e468ac to your computer and use it in GitHub Desktop.
This file demonstrates the use of variables and loops for object and arrays in the JSON configuration using Jsonnet.
local environments = [ 'prod', 'test', 'dev' ];
local services = [ 'service1', 'service2', 'service3', 'service4' ];
{
environments: [
{
name: env,
services: [
'https://%s.%s.example.com' % [service, env]
for service in services
]
}
for env in environments
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment