[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 02/03: service: Export 'default-environment-variables'.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 02/03: service: Export 'default-environment-variables'. |
Date: |
Mon, 3 Feb 2020 16:47:22 -0500 (EST) |
civodul pushed a commit to branch master
in repository shepherd.
commit 501d62c4d235045e79e5aef684b5a9250c1cf8c4
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Feb 3 22:27:26 2020 +0100
service: Export 'default-environment-variables'.
* modules/shepherd/service.scm (default-environment-variables): Turn
into a parameter and export.
* doc/shepherd.texi (Service De- and Constructors): Document it.
---
doc/shepherd.texi | 13 ++++++++++++-
modules/shepherd/service.scm | 12 +++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/doc/shepherd.texi b/doc/shepherd.texi
index e652fc4..da5718b 100644
--- a/doc/shepherd.texi
+++ b/doc/shepherd.texi
@@ -6,7 +6,7 @@
@include version.texi
@set OLD-YEARS 2002, 2003
-@set NEW-YEARS 2013, 2016, 2018
+@set NEW-YEARS 2013, 2016, 2018, 2019, 2020
@copying
Copyright @copyright{} @value{OLD-YEARS} Wolfgang J@"ahrling@*
@@ -947,6 +947,17 @@ unless the @var{group} keyword argument is present and not
false.
a separate process whose PID it returns.
@end deffn
+@defvr {Scheme Variable} default-environment-variables
+This parameter (@pxref{Parameters,,, guile, GNU Guile Reference Manual})
+specifies the default list of environment variables to be defined when
+the procedures above create a new process.
+
+It must be a list of strings where each string has the format
+@code{@var{name}=@var{value}}. It defaults to what @code{environ}
+returns when the program starts (@pxref{Runtime Environment,
+@code{environ},, guile, GNU Guile Reference Manual}).
+@end defvr
+
@c @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@node Service Examples
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 321ae58..e0772e8 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1,5 +1,5 @@
;; service.scm -- Representation of services.
-;; Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès
<address@hidden>
+;; Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic
Courtès <address@hidden>
;; Copyright (C) 2002, 2003 Wolfgang Järling <address@hidden>
;; Copyright (C) 2014 Alex Sassmannshausen <address@hidden>
;; Copyright (C) 2016 Alex Kost <address@hidden>
@@ -70,6 +70,8 @@
provided-by
required-by
handle-unknown
+
+ default-environment-variables
make-forkexec-constructor
make-kill-destructor
exec-command
@@ -712,10 +714,10 @@ results."
passwd:dir)
(getcwd)))))
-(define (default-environment-variables)
- "Return the list of environment variable name/value pairs that should be
-set when starting a service."
- (environ))
+(define default-environment-variables
+ ;; The default list of environment variable name/value pairs that should be
+ ;; set when starting a service.
+ (make-parameter (environ)))
(define* (read-pid-file file #:key (max-delay 5)
(validate-pid? #f))