Files
Alvand-P/scripts/validate-app-overlay.rb
2026-08-13 19:42:08 +03:30

26 lines
639 B
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
# Validate overlay YAML files parse as Hash.
# Usage: ruby scripts/validate-app-overlay.rb [path]
require 'yaml'
path = ARGV[0] || 'config/app.staging.yml'
unless File.exist?(path)
warn "Missing: #{path}"
exit 1
end
data = YAML.load_file(path)
if data.is_a?(Hash)
puts "OK: #{path} => Hash (#{data.keys.size} top-level keys)"
puts "Keys: #{data.keys.join(', ')}"
exit 0
end
warn "FAIL: #{path} => #{data.class}"
warn 'The file must start with key: value pairs (see config/app.staging.yml.example).'
warn 'If you pasted only a password or IP, recreate the full file.'
exit 1