3 Description : Gargantext starter
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
10 Script to start gargantext with different modes (Dev, Prod, Mock).
14 {-# LANGUAGE DataKinds #-}
15 {-# LANGUAGE DeriveGeneric #-}
16 {-# LANGUAGE FlexibleInstances #-}
17 {-# LANGUAGE NoImplicitPrelude #-}
18 {-# LANGUAGE OverloadedStrings #-}
19 {-# LANGUAGE StandaloneDeriving #-}
20 {-# LANGUAGE TypeOperators #-}
21 {-# LANGUAGE Strict #-}
26 import Options.Generic
27 import Data.Text (unpack)
29 import Gargantext.Prelude
30 import Gargantext.API (startGargantext, startGargantextMock)
32 --------------------------------------------------------
34 --import qualified Gargantext.Graph.Utils as U
35 --import qualified Gargantext.Graph.Distances.Conditional as C
36 --import qualified Gargantext.Graph.Distances.Distributional as D
37 --import qualified Gargantext.Graph.Distances.Matrice as M
38 --------------------------------------------------------
40 data Mode = Dev | Mock | Prod
41 deriving (Show, Read, Generic)
42 instance ParseRecord Mode
43 instance ParseField Mode
44 instance ParseFields Mode
47 data MyOptions w = MyOptions { run :: w ::: Mode <?> "Possible modes: Dev | Mock | Prod"
48 , port :: w ::: Maybe Int <?> "By default: 8008"
49 , ini :: w ::: Maybe Text <?> "Ini-file path of gargantext.ini"
53 instance ParseRecord (MyOptions Wrapped)
54 deriving instance Show (MyOptions Unwrapped)
60 MyOptions myMode myPort myIniFile <- unwrapRecord
61 "Gargantext: collaborative platform for text-mining"
63 let myPort' = case myPort of
67 let start = case myMode of
68 --Nothing -> startGargantext myPort' (unpack myIniFile')
69 Prod -> startGargantext myPort' (unpack myIniFile')
71 myIniFile' = case myIniFile of
72 Nothing -> panic "For Prod mode, you need to fill a gargantext.ini file"
74 Mock -> startGargantextMock myPort'
75 _ -> startGargantextMock myPort'
77 putStrLn $ "Starting Gargantext with mode: " <> show myMode
81 --main' = putStrLn $ show $ M.conditional $ M.myMat 10