Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7122877
D275.id923.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D275.id923.diff
View Options
diff --git a/manifests/instance.pp b/manifests/instance.pp
--- a/manifests/instance.pp
+++ b/manifests/instance.pp
@@ -7,6 +7,9 @@
# [*ensure*]
# Whether the instance should be enabled, present (but disabled) or absent.
#
+# [*environment*]
+# A hash of environment variables to start the service with.
+#
# [*executable*]
# The wsgi callable to pass to gunicorn
#
@@ -17,6 +20,9 @@
#
# gunicorn::instance {'foo':
# ensure => enabled,
+# environment => {
+# FOOENV => 'foovar',
+# }
# executable => 'foo.wsgi:app'
# user => 'foouser',
# group => 'foogroup',
@@ -53,7 +59,8 @@
$config_mode = '0644',
$working_dir = undef,
$log_only_errors = true,
- $settings = {}
+ $settings = {},
+ $environment = {}
) {
$config_file = "/etc/gunicorn/instances/${name}.cfg"
$service_name = "gunicorn-${name}"
@@ -94,6 +101,7 @@
# Uses variables:
# - $config_file
+ # - $environment
# - $executable
# - $group
# - $name
diff --git a/templates/gunicorn-instance.service.erb b/templates/gunicorn-instance.service.erb
--- a/templates/gunicorn-instance.service.erb
+++ b/templates/gunicorn-instance.service.erb
@@ -13,6 +13,9 @@
PIDFile=<%= @runtime_dir %>/pidfile
RuntimeDirectory=<%= @runtime_dir %>
WorkingDirectory=<%= @working_dir_override %>
+<% @environment.each do |key,value| %>
+Environment=<%= key %>=<%= var %>
+<% end %>
ExecStart=/usr/bin/gunicorn3 -p <%= @runtime_dir %>/pidfile -c <%= @config_file %> <%= @executable %>
ExecStop=/bin/kill -TERM $MAINPID
ExecReload=/bin/kill -HUP $MAINPID
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 17 2024, 9:08 AM (13 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3230662
Attached To
D275: service: add a way to pass environment variables to the gunicorn process
Event Timeline
Log In to Comment