Create utility to load updated languages

This commit is contained in:
Rene Vergara 2023-10-23 13:43:45 -05:00
parent 9c44d0443e
commit a20271db6d
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2
5 changed files with 18 additions and 6 deletions

View file

@ -29,5 +29,6 @@ main = do
expireOwners pipe (c_dbName loadedConfig)
updateLogins pipe loadedConfig
expireProSessions pipe (c_dbName loadedConfig)
loadTranslations pipe loadedConfig
close pipe
else fail "MongoDB connection failed!"

View file

@ -15,6 +15,7 @@ import Control.Monad.IO.Class
import Crypto.RNG (newCryptoRNGState, runCryptoRNGT)
import Crypto.RNG.Utils (randomString)
import Data.Aeson
import Data.Aeson (decodeFileStrict)
import Data.Array
import qualified Data.Bson as B
import qualified Data.ByteArray as BA
@ -2176,3 +2177,13 @@ upsertBlock b = do
findBlock :: Action IO (Maybe Document)
findBlock = findOne (select ["network" =: ("mainnet" :: String)] "blocks")
loadTranslations :: Pipe -> Config -> IO ()
loadTranslations pipe config = do
itemList <- decodeFileStrict "zgolanguagedb.json"
case itemList of
Nothing -> print "Couldn't not parse JSON file"
Just langItems ->
mapM_
(access pipe master (c_dbName config) . loadLangComponent)
(langItems :: [LangComponent])

View file

@ -17,7 +17,7 @@
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-21.4
resolver: lts-21.17
#url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/4.yaml
# User packages to be built.

View file

@ -103,7 +103,7 @@ packages:
hackage: crypto-rng-0.3.0.1@sha256:04f4ae75943ecad8b794950985054130f272d65a588b6b6528f56df0bfedc4dc,1565
snapshots:
- completed:
sha256: caa77fdbc5b9f698262b21ee78030133272ec53116ad6ddbefdc4c321f668e0c
size: 640014
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/4.yaml
original: lts-21.4
sha256: 85d2382958c178491d3fe50d770a624621f5ab456beef7d31ac7521f780c9bc7
size: 640042
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/17.yaml
original: lts-21.17

View file

@ -1,6 +1,6 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.35.1.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack