jwhitcraft/dockercompose-generator

View on GitHub
lib/docker-compose/generator/service/environment.rb

Summary

Maintainability
A
0 mins
Test Coverage
module DockerCompose
  module Generator
    class Service
      # Handles Environment Variables in the docker-compose file
      module Environment
        def add_environment(name, value)
          add_to_object('environment', name.upcase, value)
        end

        def drop_environment(name)
          drop_from_object('environment', name.upcase)
        end

        def get_environment(name)
          get_from_object('environment', name.upcase) if environment?(name)
        end

        def environment?(name)
          (@attrs['environment'] && @attrs['environment'][name.upcase])
        end
      end
    end
  end
end