From 3aade95b853f85395ab6f55a40997ac0526cde48 Mon Sep 17 00:00:00 2001 From: Amneesh Singh Date: Sun, 16 Apr 2023 00:52:15 +0530 Subject: [PATCH] src: change deploy target Signed-off-by: Amneesh Singh --- flake.nix | 2 ++ src/site.hs | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) 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 =