3 Description : Gargantext starter
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE NoImplicitPrelude #-}
14 {-# LANGUAGE DeriveGeneric #-}
15 {-# LANGUAGE OverloadedStrings #-}
19 import Options.Generic
20 import Data.Text (unpack)
22 import Gargantext.Prelude
23 import Gargantext.API (startGargantext, startGargantextMock)
25 ------------------------------------------------------
27 data Mode = Dev | Mock | Prod
28 deriving (Show, Read, Generic)
29 instance ParseRecord Mode
30 instance ParseField Mode
31 instance ParseFields Mode
33 data MyOptions = MyOptions { port :: Maybe Int
34 , iniFile :: Maybe Text
37 deriving (Generic, Show)
39 instance ParseRecord MyOptions
45 MyOptions myPort myIniFile myMode <- getRecord
46 "Gargantext: collaborative platform for text-mining"
48 let myPort' = case myPort of
53 let start = case myMode of
54 --Nothing -> startGargantext myPort' (unpack myIniFile')
55 Just Prod -> startGargantext myPort' (unpack myIniFile')
57 myIniFile' = case myIniFile of
58 Nothing -> panic "Need gargantext.ini file"
60 Just Mock -> startGargantextMock myPort'
61 _ -> startGargantextMock myPort'