Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save blakewrege/7368e94b2a9171e44c8c7bd56c9c6cec to your computer and use it in GitHub Desktop.
Save blakewrege/7368e94b2a9171e44c8c7bd56c9c6cec 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