Compare commits
9 Commits
c21d912e34
...
52e7ffc717
Author | SHA1 | Date | |
---|---|---|---|
52e7ffc717 | |||
c2c48c52d4 | |||
a98b362cbd | |||
af5729b5f8 | |||
bf4cab8c0d | |||
f0cb131fb6 | |||
8b76060416 | |||
611e7f25a8 | |||
4a27b6a66f |
@ -76,21 +76,24 @@ the tiedote.md user on this system.")
|
||||
"--sender-name" #$sender-name
|
||||
"--sendmail" #$sendmail-path
|
||||
"--socket" #$socket-path
|
||||
"server"
|
||||
"--repository" repo-path
|
||||
"--port" #$(number->string port)
|
||||
"--remote-url" #$remote-url
|
||||
;,@(if #$(maybe-value-set? remote-branch)
|
||||
; (list "--remote-branch" #$remote-branch)
|
||||
; '())
|
||||
"server")
|
||||
)
|
||||
#:user "tiedote.md"
|
||||
#:group "tiedote.md"
|
||||
#:environment (cons "GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt"
|
||||
(default-environment-variable))
|
||||
#:directory #$state-directory))))
|
||||
(stop #~(make-kill-destructor))))))
|
||||
|
||||
(define (tiedote.md-activation config)
|
||||
(match-record config <tiedote.md-configuration>
|
||||
(state-directory)
|
||||
(state-directory email-address sender-name sendmail-path socket-path)
|
||||
(let* ((receive-exec (list (file-append tiedote-md "/bin/tiedote.md") ; file to exec
|
||||
(file-append tiedote-md "/bin/tiedote.md") ; arg $0
|
||||
"--address" email-address
|
||||
@ -99,9 +102,11 @@ the tiedote.md user on this system.")
|
||||
"--socket" socket-path))
|
||||
(receive-script (program-file "tiedote.md-receive"
|
||||
#~(apply execl #$receive-exec)))
|
||||
(forward-file (mixed-text-file ".forward" "|" receive-script)))
|
||||
#~(symlink #$forward-file
|
||||
(string-append #$state-directory "/.forward")))))
|
||||
(forward-file (mixed-text-file "dot-forward" "|" receive-script)))
|
||||
#~(let ((.forward (string-append #$state-directory "/.forward")))
|
||||
(if (file-exists? .forward)
|
||||
(delete-file .forward))
|
||||
(symlink #$forward-file .forward)))))
|
||||
|
||||
(define tiedote.md-service-type
|
||||
(service-type
|
||||
|
@ -6,12 +6,12 @@ module Main where
|
||||
|
||||
import Control.Applicative (optional)
|
||||
import Control.Concurrent (forkIO, threadDelay)
|
||||
import Control.Exception (onException)
|
||||
import Control.Exception (onException, catch)
|
||||
import Control.Exception (throwIO)
|
||||
import Control.Monad (void, forever)
|
||||
import Data.Acid (AcidState(..), openLocalState, createCheckpoint, createArchive)
|
||||
import Data.Acid.Remote (skipAuthenticationCheck, acidServerSockAddr, openRemoteStateSockAddr, skipAuthenticationPerform)
|
||||
import Data.FileStore (gitFileStore, initialize)
|
||||
import Data.FileStore (gitFileStore, initialize, FileStoreError(RepositoryExists))
|
||||
import Data.IMF (Mailbox(..), parse, mailbox)
|
||||
import Data.MIME.Charset (defaultCharsets)
|
||||
import Data.Text.Encoding (encodeUtf8)
|
||||
@ -36,7 +36,7 @@ import TiedoteMD.Debug
|
||||
|
||||
serverMain :: SockAddr -> Mailbox -> FilePath -> GitOrigin -> FilePath -> Int -> Int -> IO ()
|
||||
serverMain socket mail repoPath origin sendmailPath checkpointDelay port = do
|
||||
initialize $ gitFileStore repoPath
|
||||
initialize (gitFileStore repoPath) `catch` \RepositoryExists -> pure ()
|
||||
acid <- openLocalState $ emptyState
|
||||
_ <- forkIO $ acidServerSockAddr skipAuthenticationCheck socket acid
|
||||
queueMessages acid
|
||||
|
Loading…
Reference in New Issue
Block a user