diff --git a/flake.nix b/flake.nix index 2848874..cda229d 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,8 @@ haskell-language-server ghcid ]; + SSHTARGET = "bat@weirdnatto.in:/var/lib/site/"; + SSHTARGETPORT = 22001; }; packages = { inherit nattopages site; diff --git a/src/site.hs b/src/site.hs index 0ad41df..41fb570 100644 --- a/src/site.hs +++ b/src/site.hs @@ -19,6 +19,8 @@ import Text.Pandoc ) import qualified Text.Pandoc as Pandoc import Text.Pandoc.Templates (Template, compileTemplate) +import System.Environment (getEnv) +import System.IO.Unsafe (unsafePerformIO) -------------------------------------------------------------------------------- @@ -213,12 +215,14 @@ rssFeedConfiguration = config :: Configuration config = defaultConfiguration - { deployCommand = - "rsync --checksum -ave 'ssh -p 22001' \ - \_site/* \ - \root@weirdnatto.in:/var/lib/site/", + { deployCommand = "rsync --checksum -ave 'ssh -p" ++ sshTargetPort ++"' _site/* " ++ sshTarget, previewPort = 3333 } + where + {-# NOINLINE sshTarget#-} + sshTarget = unsafePerformIO $ getEnv "SSHTARGET" + {-# NOINLINE sshTargetPort#-} + sshTargetPort = unsafePerformIO $ getEnv "SSHTARGETPORT" postCtx :: Tags -> Context String postCtx tags =