Skip to content
Snippets Groups Projects
Commit 3b7ffb35 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Add a gitlab.yml conversion support script

parent 778b26bf
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,6 +2,7 @@
- Make SSH port in clone URLs configurable (Julien Pivotto)
- Fix default Postgres port for non-packaged DBMS (Drew Blessing)
- Add migration instructions coming from an existing GitLab installation (Goni Zahavy)
- Add a gitlab.yml conversion support script
 
6.8.1
- Use gitlab-rails 6.8.1
Loading
Loading
# This script translates settings from a gitlab.yml file to the format of
# omnibus-gitlab's /etc/gitlab/gitlab.rb file.
#
# The output is NOT a valid gitlab.rb file! The purpose of this script is only
# to reduce copy and paste work.
#
# Usage: ruby gitlab_yml_converter.rb /path/to/gitlab.yml
require 'yaml'
module GitlabYamlConverter
class Flattener
def initialize(separator='_')
@separator = separator
end
def flatten(hash, prefix=nil)
Enumerator.new do |yielder|
hash.each do |key, value|
raise "Bad key: #{key.inspect}" unless key.is_a?(String)
key = [prefix, key].join(@separator) if prefix
if value.is_a?(Hash)
flatten(value, key).each do |nested_key_value|
yielder.yield nested_key_value
end
else
yielder.yield [key, value]
end
end
end
end
end
def self.convert(gitlab_yml)
Flattener.new.flatten(gitlab_yml['production']).each do |key, value|
puts "gitlab_rails['#{key}'] = #{value.inspect}"
end
end
end
if $0 == __FILE__
GitlabYamlConverter.convert(YAML.load(ARGF.read))
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment