Skip to content

Commit

Permalink
Support "environment-vars" setting in puppetserver.conf
Browse files Browse the repository at this point in the history
Fixes #792
  • Loading branch information
phihos committed Sep 22, 2021
1 parent 7534cbe commit 4d509a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@
#
# $server_jruby_gem_home:: Where jruby gems are located for puppetserver
#
# $server_environment_vars:: A hash of environment variables and their values
# which the puppetserver is allowed to see.
# To pass an existing variable use {'MYVAR': '${MYVAR}'}.
#
# $allow_any_crl_auth:: Allow any authentication for the CRL. This
# is needed on the puppet CA to accept clients
# from a the puppet CA proxy.
Expand Down Expand Up @@ -699,6 +703,7 @@
Optional[Variant[String,Array[String]]] $server_jvm_extra_args = $puppet::params::server_jvm_extra_args,
Optional[String] $server_jvm_cli_args = $puppet::params::server_jvm_cli_args,
Optional[Stdlib::Absolutepath] $server_jruby_gem_home = $puppet::params::server_jruby_gem_home,
Hash[String, String] $server_environment_vars = $puppet::params::server_environment_vars,
Integer[1] $server_max_active_instances = $puppet::params::server_max_active_instances,
Integer[0] $server_max_requests_per_instance = $puppet::params::server_max_requests_per_instance,
Integer[0] $server_max_queued_requests = $puppet::params::server_max_queued_requests,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@
$server_ca_allow_auth_extensions = false
$server_ca_enable_infra_crl = false
$server_max_open_files = undef
$server_environment_vars = {}

$server_puppetserver_version = undef

Expand Down
14 changes: 14 additions & 0 deletions templates/server/puppetserver/conf.d/puppetserver.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ jruby-puppet: {

# (optional) enable or disable environment class cache
environment-class-cache-enabled: <%= @server_environment_class_cache_enabled %>

# (optional) A map of environment variables which are made visible to
# Ruby code running within JRuby, for example, via the Ruby ENV class.
# By default, the only environment variables whose values are set into JRuby from the shell are HOME and PATH.
# The default value for the GEM_HOME environment variable in JRuby is set from the value provided for the
# jruby-puppet.gem-home key.
# Any variable set from the map for the environment-vars key overrides these defaults.
# Avoid overriding HOME, PATH, or GEM_HOME here because these values are already configurable via the shell
# or jruby-puppet.gem-home.
environment-vars: {
<%- @server_environment_vars.each do |env_key, env_val| -%>
"<%= env_key %>" : <%= env_val %>
<%- end -%>
}
<%- if @compile_mode %>

compile-mode: <%= @compile_mode %>
Expand Down

0 comments on commit 4d509a2

Please sign in to comment.