diff --git a/providers/celery.rb b/providers/celery.rb index f008454..1b74b33 100644 --- a/providers/celery.rb +++ b/providers/celery.rb @@ -80,9 +80,14 @@ django_resource = new_resource.application.sub_resources.select{|res| res.type == :django}.first raise "No Django deployment resource found" unless django_resource command "#{::File.join(django_resource.virtualenv, "bin", "python")} manage.py #{cmd}" + environment new_resource.environment else command cmd - environment 'CELERY_CONFIG_MODULE' => new_resource.config + if new_resource.environment + environment new_resource.environment.merge({'CELERY_CONFIG_MODULE' => new_resource.config}) + else + environment 'CELERY_CONFIG_MODULE' => new_resource.config + end end directory ::File.join(new_resource.path, "current") autostart false diff --git a/providers/gunicorn.rb b/providers/gunicorn.rb index f241cc0..71df9e4 100644 --- a/providers/gunicorn.rb +++ b/providers/gunicorn.rb @@ -32,7 +32,7 @@ gunicorn_install "gunicorn-#{new_resource.application.name}" do virtualenv django_resource ? django_resource.virtualenv : new_resource.virtualenv end - + if !new_resource.restart_command new_resource.restart_command do run_context.resource_collection.find(:supervisor_service => new_resource.application.name).run_action(:restart) @@ -72,6 +72,9 @@ supervisor_service new_resource.application.name do action :enable + if new_resource.environment + environment new_resource.environment + end if new_resource.app_module == :django django_resource = new_resource.application.sub_resources.select{|res| res.type == :django}.first raise "No Django deployment resource found" unless django_resource diff --git a/resources/celery.rb b/resources/celery.rb index 278ee29..71d918c 100644 --- a/resources/celery.rb +++ b/resources/celery.rb @@ -27,6 +27,7 @@ attribute :celerybeat, :kind_of => [TrueClass, FalseClass], :default => false attribute :celerycam, :kind_of => [TrueClass, FalseClass], :default => false attribute :camera_class, :kind_of => [String, NilClass], :default => nil +attribute :environment, :kind_of => [Hash], :default => {} def config_base config.split(/[\\\/]/).last diff --git a/resources/gunicorn.rb b/resources/gunicorn.rb index cb337ec..641463a 100644 --- a/resources/gunicorn.rb +++ b/resources/gunicorn.rb @@ -44,3 +44,4 @@ attribute :virtualenv, :kind_of => String, :default => nil attribute :packages, :kind_of => [Array, Hash], :default => [] attribute :requirements, :kind_of => [NilClass, String, FalseClass], :default => nil +attribute :environment, :kind_of => [Hash], :default => {}