Create utility to load updated languages
This commit is contained in:
parent
9c44d0443e
commit
a20271db6d
5 changed files with 18 additions and 6 deletions
|
@ -29,5 +29,6 @@ main = do
|
||||||
expireOwners pipe (c_dbName loadedConfig)
|
expireOwners pipe (c_dbName loadedConfig)
|
||||||
updateLogins pipe loadedConfig
|
updateLogins pipe loadedConfig
|
||||||
expireProSessions pipe (c_dbName loadedConfig)
|
expireProSessions pipe (c_dbName loadedConfig)
|
||||||
|
loadTranslations pipe loadedConfig
|
||||||
close pipe
|
close pipe
|
||||||
else fail "MongoDB connection failed!"
|
else fail "MongoDB connection failed!"
|
||||||
|
|
|
@ -15,6 +15,7 @@ import Control.Monad.IO.Class
|
||||||
import Crypto.RNG (newCryptoRNGState, runCryptoRNGT)
|
import Crypto.RNG (newCryptoRNGState, runCryptoRNGT)
|
||||||
import Crypto.RNG.Utils (randomString)
|
import Crypto.RNG.Utils (randomString)
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
|
import Data.Aeson (decodeFileStrict)
|
||||||
import Data.Array
|
import Data.Array
|
||||||
import qualified Data.Bson as B
|
import qualified Data.Bson as B
|
||||||
import qualified Data.ByteArray as BA
|
import qualified Data.ByteArray as BA
|
||||||
|
@ -2176,3 +2177,13 @@ upsertBlock b = do
|
||||||
|
|
||||||
findBlock :: Action IO (Maybe Document)
|
findBlock :: Action IO (Maybe Document)
|
||||||
findBlock = findOne (select ["network" =: ("mainnet" :: String)] "blocks")
|
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])
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#
|
#
|
||||||
# resolver: ./custom-snapshot.yaml
|
# resolver: ./custom-snapshot.yaml
|
||||||
# resolver: https://example.com/snapshots/2018-01-01.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
|
#url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/4.yaml
|
||||||
|
|
||||||
# User packages to be built.
|
# User packages to be built.
|
||||||
|
|
|
@ -103,7 +103,7 @@ packages:
|
||||||
hackage: crypto-rng-0.3.0.1@sha256:04f4ae75943ecad8b794950985054130f272d65a588b6b6528f56df0bfedc4dc,1565
|
hackage: crypto-rng-0.3.0.1@sha256:04f4ae75943ecad8b794950985054130f272d65a588b6b6528f56df0bfedc4dc,1565
|
||||||
snapshots:
|
snapshots:
|
||||||
- completed:
|
- completed:
|
||||||
sha256: caa77fdbc5b9f698262b21ee78030133272ec53116ad6ddbefdc4c321f668e0c
|
sha256: 85d2382958c178491d3fe50d770a624621f5ab456beef7d31ac7521f780c9bc7
|
||||||
size: 640014
|
size: 640042
|
||||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/4.yaml
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/17.yaml
|
||||||
original: lts-21.4
|
original: lts-21.17
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cabal-version: 1.12
|
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
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue