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
48 MyOptions { run :: w ::: Mode
49 <?> "Possible modes: Dev | Mock | Prod"
50 , port :: w ::: Maybe Int
51 <?> "By default: 8008"
52 , ini :: w ::: Maybe Text
53 <?> "Ini-file path of gargantext.ini"
57 instance ParseRecord (MyOptions Wrapped)
58 deriving instance Show (MyOptions Unwrapped)
63 MyOptions myMode myPort myIniFile <- unwrapRecord
66 let myPort' = case myPort of
70 let start = case myMode of
71 Prod -> startGargantext myPort' (unpack myIniFile')
73 myIniFile' = case myIniFile of
74 Nothing -> panic "[ERROR] gargantext.ini needed"
76 Dev -> panic "[ERROR] Dev mode unsupported"
77 Mock -> panic "[ERROR] Mock mode unsupported"
78 -- _ -> startGargantextMock myPort'
80 putStrLn $ "Starting with " <> show myMode <> " mode."