File.write(Rails.root.join('.env.production'),"# Generated with mastodon:setup on #{Time.now.utc}\n\n"+env.each_pair.map{|key,value|"#{key}=#{value}"}.join("\n")+"\n")
env_contents=env.each_pair.mapdo|key,value|
ifvalue.is_a?(String)&&value=~/[\s\#\\"]/
ifvalue=~/[']/
value=value.to_s.gsub(/[\\"\$]/){|x|"\\#{x}"}
"#{key}=\"#{value}\""
else
"#{key}='#{value}'"
end
else
"#{key}=#{value}"
end
end.join("\n")
File.write(Rails.root.join('.env.production'),"# Generated with mastodon:setup on #{Time.now.utc}\n\n"+env_contents+"\n")
ifusing_docker
prompt.ok'Below is your configuration, save it to an .env.production file outside Docker:'