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