From ac32f29c83e08ecdf05e7d9663b76a841adefb7d Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Fri, 22 Mar 2024 20:01:02 -0400 Subject: [PATCH] Move JSONSettings into Common.Server --- chan-delorean.cabal | 2 +- src/Backfill.hs | 14 +++++++------- src/Common | 2 +- src/JSONSettings.hs | 17 ----------------- src/Network/DataClient.hs | 2 +- 5 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 src/JSONSettings.hs diff --git a/chan-delorean.cabal b/chan-delorean.cabal index 0eb0ef9..655dbf7 100644 --- a/chan-delorean.cabal +++ b/chan-delorean.cabal @@ -67,7 +67,6 @@ executable chan-delorean -- Modules included in this executable, other than Main. other-modules: JSONParsing - JSONSettings SitesType BoardsType ThreadType @@ -80,6 +79,7 @@ executable chan-delorean Data.WordUtil Network.DataClient Network.DataClientTypes + Common.Server.JSONSettings -- LANGUAGE extensions used by modules in this package. -- other-extensions: diff --git a/src/Backfill.hs b/src/Backfill.hs index 84e4616..317604d 100644 --- a/src/Backfill.hs +++ b/src/Backfill.hs @@ -33,7 +33,7 @@ import Network.Mime (defaultMimeLookup) import PerceptualHash (fileHash) import JSONParsing -import JSONSettings +import Common.Server.JSONSettings import qualified JSONCommonTypes as JS import qualified JSONPost as JSONPosts import qualified Network.DataClient as Client @@ -96,11 +96,11 @@ ensureSiteExists settings = do createArchivesForNewBoards - :: JSONSettings -> - Set String -> - [ String ] -> - Int -> - IO [ Boards.Board ] + :: JSONSettings + -> Set String + -> [ String ] + -> Int + -> IO [ Boards.Board ] createArchivesForNewBoards settings dirsSet archived_boards siteid = do let archivedBoardsSet = Set.fromList archived_boards @@ -341,7 +341,7 @@ copyFiles settings (site, board, thread, _, path, attachment) = do common_dest :: FilePath common_dest - = (JSONSettings.media_root_path settings) + = (media_root_path settings) Sites.name site Boards.pathpart board (show $ Threads.board_thread_id thread) diff --git a/src/Common b/src/Common index cff3dd9..eb624ed 160000 --- a/src/Common +++ b/src/Common @@ -1 +1 @@ -Subproject commit cff3dd9e9fd013a0eedaa17df52e8f9eb5ef73c6 +Subproject commit eb624edd0e0be526f7ccfda080b437d7a365f466 diff --git a/src/JSONSettings.hs b/src/JSONSettings.hs deleted file mode 100644 index 144b52d..0000000 --- a/src/JSONSettings.hs +++ /dev/null @@ -1,17 +0,0 @@ -module JSONSettings - ( JSONSettings(..) - ) where - -import GHC.Generics -import Data.Aeson (FromJSON) - -data JSONSettings = JSONSettings - { postgrest_url :: String - , jwt :: String - , backup_read_root :: FilePath - , media_root_path :: FilePath - , site_name :: String - , site_url :: String - } deriving (Show, Generic) - -instance FromJSON JSONSettings diff --git a/src/Network/DataClient.hs b/src/Network/DataClient.hs index 4a1d32b..38addb2 100644 --- a/src/Network/DataClient.hs +++ b/src/Network/DataClient.hs @@ -37,7 +37,7 @@ import Data.Aeson ) import GHC.Generics -import qualified JSONSettings as T +import qualified Common.Server.JSONSettings as T import qualified SitesType as Sites import qualified BoardsType as Boards import qualified ThreadType as Threads