summaryrefslogtreecommitdiff
path: root/manifests/service/env.pp
blob: 2699533e4753ff4e6ce641f455106f5053c94cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# the env $name must be unique
define runit::service::env( $service, $value, $ensure = present ) {
  
  $envdir = "/etc/sv/${service}/env"
  
  # create this directory if at least one environment variable is defined
  if !defined( File["/etc/sv/${service}/env"] ) {
    file{ "/etc/sv/${service}/env":
      ensure  => directory,
      # all unmanaged envs. will be removed
      recurse => true,
      purge   => true,
    }
  }
  
  file { "${envdir}/${name}":
    ensure => $ensure,
    content => "${value}\n",
  }

}