]> Git — Sourcephile - gargantext.git/blob - bin/gargantext-invitations/Main.hs
improve performance of logDistributional, upgrade to accelerate 1.3 + lots of debug...
[gargantext.git] / bin / gargantext-invitations / Main.hs
1 {-|
2 Module : Main.hs
3 Description : GarganText Mailing Invitations
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10
11 -}
12
13 {-# LANGUAGE Strict #-}
14
15 module Main where
16
17 import Data.Either (Either(..))
18 import Gargantext.API.Dev (withDevEnv, runCmdDev)
19 import Gargantext.API.Node () -- instances only
20 import Gargantext.API.Prelude (GargError)
21 import Gargantext.Core.Types.Individu (User(..), arbitraryNewUsers, NewUser(..), arbitraryUsername, GargPassword(..))
22 import Gargantext.Database.Action.Flow (getOrMkRoot, getOrMk_RootWithCorpus)
23 import Gargantext.Database.Admin.Config (userMaster, corpusMasterName)
24 import Gargantext.Database.Admin.Trigger.Init (initFirstTriggers, initLastTriggers)
25 import Gargantext.Database.Admin.Types.Hyperdata (HyperdataCorpus)
26 import Gargantext.Database.Admin.Types.Node
27 import Gargantext.Database.Prelude (CmdR)
28 import Gargantext.Database.Query.Table.Node (getOrMkList)
29 import Gargantext.Database.Query.Table.User (insertNewUsers, )
30 import Gargantext.Prelude
31 import Gargantext.Prelude.Config (GargConfig(..), readConfig)
32 import Prelude (getLine)
33 import System.Environment (getArgs)
34 import Gargantext.Database.Action.User.New (newUsers)
35
36 main :: IO ()
37 main = do
38 params@[iniPath,email] <- getArgs
39
40 _ <- if length params /= 2
41 then panic "USAGE: ./gargantext-init gargantext.ini student@university.edu"
42 else pure ()
43
44 cfg <- readConfig iniPath
45
46 let createUsers :: CmdR GargError Int64
47 createUsers = newUsers [cs email]
48
49 withDevEnv iniPath $ \env -> do
50 _ <- runCmdDev env createUsers
51 pure ()