Sha256: 27070cb096d297638588429de6aa14f0578f78af0eeca859cfa15c8ea6e6d516

Contents?: true

Size: 941 Bytes

Versions: 2

Compression:

Stored size: 941 Bytes

Contents

#!/usr/bin/env ruby

require_relative "../lib/configgin"

options = {}
parser = Cli.make_option_parser(options)

parser.parse!(ARGV)

begin
  Cli.check_opts(options)
rescue ArgMissingError => e
  STDERR.puts("missing argument: #{e}")
  exit(1)
end

jobs = JSON.load(File.read(options[:jobs]))
templates = YAML.load_file(options[:env2conf])

jobs.each do |job, job_config|
  base_config = JSON.load(File.read(job_config['base']))

  job_config['files'].each do |infile, outfile|
    begin
      bosh_spec = EnvironmentConfigTransmogrifier.transmogrify(base_config,
                                                               templates,
                                                               secrets: '/etc/secrets')
    rescue NonHashValueOverride => e
      STDERR.puts e.to_s
      STDERR.puts "Error generating #{job}: #{outfile} from #{infile}"
      exit 1
    end

    Generate.generate(bosh_spec, infile, outfile)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
configgin-0.12.0 bin/configgin
configgin-0.12.0.pre bin/configgin