services: Reindent vpn.scm.
This fixes indentation of 'match' forms. * gnu/services/vpn.scm: Pass through 'indent-code.el'.
This commit is contained in:
parent
830d4c1fcd
commit
be051880c4
|
@ -46,11 +46,11 @@
|
||||||
|
|
||||||
(define (uglify-field-name name)
|
(define (uglify-field-name name)
|
||||||
(match name
|
(match name
|
||||||
('verbosity "verb")
|
('verbosity "verb")
|
||||||
(_ (let ((str (symbol->string name)))
|
(_ (let ((str (symbol->string name)))
|
||||||
(if (string-suffix? "?" str)
|
(if (string-suffix? "?" str)
|
||||||
(substring str 0 (1- (string-length str)))
|
(substring str 0 (1- (string-length str)))
|
||||||
str)))))
|
str)))))
|
||||||
|
|
||||||
(define (serialize-field field-name val)
|
(define (serialize-field field-name val)
|
||||||
(if (eq? field-name 'pid-file)
|
(if (eq? field-name 'pid-file)
|
||||||
|
@ -108,8 +108,8 @@
|
||||||
(define (serialize-tls-auth role location)
|
(define (serialize-tls-auth role location)
|
||||||
(serialize-field 'tls-auth
|
(serialize-field 'tls-auth
|
||||||
(string-append location " " (match role
|
(string-append location " " (match role
|
||||||
('server "0")
|
('server "0")
|
||||||
('client "1")))))
|
('client "1")))))
|
||||||
(define (tls-auth? val)
|
(define (tls-auth? val)
|
||||||
(or (eq? val #f)
|
(or (eq? val #f)
|
||||||
(string? val)))
|
(string? val)))
|
||||||
|
@ -230,10 +230,10 @@ client. Each file is named after the name of the client."
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (ccd)
|
(lambda (ccd)
|
||||||
(match ccd
|
(match ccd
|
||||||
((name config-string)
|
((name config-string)
|
||||||
(call-with-output-file
|
(call-with-output-file
|
||||||
(string-append #$output "/" name)
|
(string-append #$output "/" name)
|
||||||
(lambda (port) (display config-string port))))))
|
(lambda (port) (display config-string port))))))
|
||||||
'#$files))))))
|
'#$files))))))
|
||||||
|
|
||||||
(define-syntax define-split-configuration
|
(define-syntax define-split-configuration
|
||||||
|
@ -378,53 +378,53 @@ is trunkated and rewritten every minute.")
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(serialize-configuration config
|
(serialize-configuration config
|
||||||
(match role
|
(match role
|
||||||
('server
|
('server
|
||||||
openvpn-server-configuration-fields)
|
openvpn-server-configuration-fields)
|
||||||
('client
|
('client
|
||||||
openvpn-client-configuration-fields))))))
|
openvpn-client-configuration-fields))))))
|
||||||
(ccd-dir (match role
|
(ccd-dir (match role
|
||||||
('server (create-ccd-directory
|
('server (create-ccd-directory
|
||||||
(openvpn-server-configuration-client-config-dir
|
(openvpn-server-configuration-client-config-dir
|
||||||
config)))
|
config)))
|
||||||
('client #f))))
|
('client #f))))
|
||||||
(computed-file "openvpn.conf"
|
(computed-file "openvpn.conf"
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (ice-9 match))
|
(use-modules (ice-9 match))
|
||||||
(call-with-output-file #$output
|
(call-with-output-file #$output
|
||||||
(lambda (port)
|
(lambda (port)
|
||||||
(match '#$role
|
(match '#$role
|
||||||
('server (display "" port))
|
('server (display "" port))
|
||||||
('client (display "client\n" port)))
|
('client (display "client\n" port)))
|
||||||
(display #$config-str port)
|
(display #$config-str port)
|
||||||
(match '#$role
|
(match '#$role
|
||||||
('server (display
|
('server (display
|
||||||
(string-append "client-config-dir "
|
(string-append "client-config-dir "
|
||||||
#$ccd-dir "\n") port))
|
#$ccd-dir "\n") port))
|
||||||
('client (display "" port)))))))))
|
('client (display "" port)))))))))
|
||||||
|
|
||||||
(define (openvpn-shepherd-service role)
|
(define (openvpn-shepherd-service role)
|
||||||
(lambda (config)
|
(lambda (config)
|
||||||
(let* ((config-file (openvpn-config-file role config))
|
(let* ((config-file (openvpn-config-file role config))
|
||||||
(pid-file ((match role
|
(pid-file ((match role
|
||||||
('server openvpn-server-configuration-pid-file)
|
('server openvpn-server-configuration-pid-file)
|
||||||
('client openvpn-client-configuration-pid-file))
|
('client openvpn-client-configuration-pid-file))
|
||||||
config))
|
config))
|
||||||
(openvpn ((match role
|
(openvpn ((match role
|
||||||
('server openvpn-server-configuration-openvpn)
|
('server openvpn-server-configuration-openvpn)
|
||||||
('client openvpn-client-configuration-openvpn))
|
('client openvpn-client-configuration-openvpn))
|
||||||
config))
|
config))
|
||||||
(log-file (match role
|
(log-file (match role
|
||||||
('server "/var/log/openvpn-server.log")
|
('server "/var/log/openvpn-server.log")
|
||||||
('client "/var/log/openvpn-client.log"))))
|
('client "/var/log/openvpn-client.log"))))
|
||||||
(list (shepherd-service
|
(list (shepherd-service
|
||||||
(documentation (string-append "Run the OpenVPN "
|
(documentation (string-append "Run the OpenVPN "
|
||||||
(match role
|
(match role
|
||||||
('server "server")
|
('server "server")
|
||||||
('client "client"))
|
('client "client"))
|
||||||
" daemon."))
|
" daemon."))
|
||||||
(provision (match role
|
(provision (match role
|
||||||
('server '(vpn-server))
|
('server '(vpn-server))
|
||||||
('client '(vpn-client))))
|
('client '(vpn-client))))
|
||||||
(requirement '(networking))
|
(requirement '(networking))
|
||||||
(start #~(make-forkexec-constructor
|
(start #~(make-forkexec-constructor
|
||||||
(list (string-append #$openvpn "/sbin/openvpn")
|
(list (string-append #$openvpn "/sbin/openvpn")
|
||||||
|
|
Loading…
Reference in New Issue