lib/dockistrano/service.rb
# Returns an array of environment variables
Returns an array of environment variables
Returns an array of environment variables
def environment_variables
      vars = {}
      config["environment"].each do |name, value|
        vars[name.upcase] = value
      end
      backing_services.each do |name, backing_service|
        backing_service.backing_service_env.each do |k,v|
          vars["#{name.upcase}_#{k.upcase}"] = v
        end
        vars.merge!(backing_service.provided_environment_variables)
      end
      vars.each do |key, value|
        vars.each do |replacement_key, replacement_value|
          vars[key] = if vars[key].nil? or replacement_value.nil? or replacement_value.empty?
            vars[key].gsub('$'+replacement_key, '$'+replacement_key)
          else
            vars[key].gsub('$'+replacement_key, replacement_value)
          end
        end
      end
      vars
    end
def environment_variables vars = { } config [ "environment" ] . each do | name , value | vars [ name . upcase ] = value end backing_services . each do | name , backing_service | backing_service . backing_service_env . each do | k , v | vars [ "#{name.upcase}_#{k.upcase}" ] = v end vars . merge! ( backing_service . provided_environment_variables ) end vars . each do | key , value | vars . each do | replacement_key , replacement_value | vars [ key ] = if vars [ key ] . nil? or replacement_value . nil? or replacement_value . empty? vars [ key ] . gsub ( '$' + replacement_key , '$' + replacement_key ) else vars [ key ] . gsub ( '$' + replacement_key , replacement_value ) end end end vars end
Returns an array of environment variables
Returns an array of environment variables