Pass frontend to service

This commit is contained in:
TakeV 2023-06-28 16:10:22 -07:00
parent a5de15253c
commit 82a0f9fb56
Signed by: TakeV
GPG Key ID: A64F41345C7400AF
1 changed files with 10 additions and 5 deletions

View File

@ -17,26 +17,31 @@
make-gts-config
gts-config?
(pkg gotosocial-configuration-package (default gotosocial))
(front-end gotosocial-configuration-frontend-package (default gotosocial-frontend))
(config-file gotosocial-configuration-config (default #f)) ; file-like
(port gotosocial-port (default #f))
(cert-dir gotosocial-letsencrypt-cert-dir (default #f))
(storage-dir gotosocial-storage-local-base-path (default #f))
(web-asset-dir gotosocial-web-asset-dir (default #f))
(web-template-dir gotosocial-template-asset-dir (default #f))
(host gotosocial-host (default #f))
(db-type gotosocial-db-type (default #f))
(db-address gotosocial-db-address (default #f)))
(define gotosocial-shepherd-service
(match-lambda (($ <gts-config> pkg config-file port cert-dir storage-dir web-asset-dir host db-type db-address)
(let* ((gotosocial (file-append pkg "/bin/gotosocial"))
(command `(,gotosocial
"server" "start"
(match-lambda (($ <gts-config> pkg front-end config-file port cert-dir storage-dir web-asset-dir web-template-dir host db-type db-address)
(let* ((gts (file-append pkg "/bin/gotosocial"))
(gts-frontend-assets (file-append front-end "/gotosocial/web/assets"))
(gts-frontend-templates (file-append front-end "/gotosocial/web/template"))
(command `(,gts
"server" "start" "--syslog-enabled"
,@(if port `(,(string-append "--port=" (number->string port))) '())
,@(if db-type `(,(string-append "--db-type=" db-type)) '())
,@(if db-address `(,(string-append "--db-address=" db-address)) '())
,@(if cert-dir `(,(string-append "--letsencrypt-cert-dir=" cert-dir)) '())
,@(if storage-dir `(,(string-append "--storage-local-base-path=" storage-dir)) '())
,@(if web-asset-dir `(,(string-append "--letsencrypt-cert-dir=" web-asset-dir)) '())
,@(if web-asset-dir `(,(string-append "--web-asset-base-dir=" web-asset-dir)) '(,(string-append "--web-asset-base-dir=" gts-frontend-assets)))
,@(if web-template-dir `(,(string-append "--web-template-base-dir=" web-template-dir)) '(,(string-append "--web-template-base-dir=" gts-frontend-templates)))
,@(if config-file `(,(string-append "--config-path=" config-file)) '())
,@(if host `(,(string-append "--host=" host)) '())
)))