3 Description : Gargantext starter
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
11 {-# LANGUAGE DataKinds #-}
12 {-# LANGUAGE DeriveGeneric #-}
13 {-# LANGUAGE FlexibleInstances #-}
14 {-# LANGUAGE OverloadedStrings #-}
15 {-# LANGUAGE StandaloneDeriving #-}
16 {-# LANGUAGE TypeOperators #-}
17 {-# LANGUAGE Strict #-}
21 import Prelude (putStrLn)
23 import Options.Generic
24 import Data.Text (unpack)
26 import Gargantext.Prelude
27 import Gargantext.API (startGargantext, startGargantextMock)
29 import qualified Gargantext.Graph.Utils as U
30 import qualified Gargantext.Graph.Distances.Conditional as C
31 import qualified Gargantext.Graph.Distances.Distributional as D
32 --------------------------------------------------------
34 data Mode = Dev | Mock | Prod
35 deriving (Show, Read, Generic)
36 instance ParseRecord Mode
37 instance ParseField Mode
38 instance ParseFields Mode
41 data MyOptions w = MyOptions { run :: w ::: Mode <?> "Possible modes: Dev | Mock | Prod"
42 , port :: w ::: Maybe Int <?> "By default: 8008"
43 , ini :: w ::: Maybe Text <?> "Ini-file path of gargantext.ini"
47 instance ParseRecord (MyOptions Wrapped)
48 deriving instance Show (MyOptions Unwrapped)
51 main = putStrLn $ show $ C.conditional U.m1
52 --main = putStrLn $ show $ map show $ take 10 $ D.distributional U.m1
56 MyOptions myMode myPort myIniFile <- unwrapRecord
57 "Gargantext: collaborative platform for text-mining"
59 let myPort' = case myPort of
63 let start = case myMode of
64 --Nothing -> startGargantext myPort' (unpack myIniFile')
65 Prod -> startGargantext myPort' (unpack myIniFile')
67 myIniFile' = case myIniFile of
68 Nothing -> panic "For Prod mode, you need to fill a gargantext.ini file"
70 Mock -> startGargantextMock myPort'
71 _ -> startGargantextMock myPort'
73 putStrLn $ "Starting Gargantext with mode: " <> show myMode