News for hackers. Stuff that matters.
Re:Yglu: YAML augmented with an expression language by iudqnolq on Thursday January 30, 2020 @11:28PM (#22199056)
Some competing languages: https://news.ycombinator.com/item?id=20357079

I'm especially interested in jsonnet (https://jsonnet.org/) because of how thoroughly it's documented.

An example that produces three different config files:

    local application = 'my-app';
    local module = 'uwsgi_module';
    local dir = '/var/www';
    local permission = 644;
    
    {
      'uwsgi.ini': std.manifestIni({
        sections: {
          uwsgi: {
            module: module,
            pythonpath: dir,
            socket: dir + '/uwsgi.sock',
            'chmod-socket': permission,
            callable: application,
            logto: '/var/log/uwsgi/uwsgi.log',
          },
        },
      }),
    
      'init.sh': |||
        #!/bin/bash
        mkdir -p %(dir)s
        touch %(dir)s/initialized
        chmod %(perm)d %(dir)s/initialized
      ||| % {dir: dir, perm: permission},
    
      'cassandra.conf': std.manifestYamlDoc({
        cluster_name: application,
        seed_provider: [
          {
            class_name: 'SimpleSeedProvider',
            parameters: [{ seeds: '127.0.0.1' }],
          },
        ],
      }),
    }

There are no comments on this comment yet.