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 Prelude (putStrLn)
21 import Options.Generic
22 import Data.Text (unpack)
24 import Gargantext.Prelude
25 import Gargantext.API (startGargantext, startGargantextMock)
27 ------------------------------------------------------
29 data Mode = Dev | Mock | Prod
30 deriving (Show, Read, Generic)
31 instance ParseRecord Mode
32 instance ParseField Mode
33 instance ParseFields Mode
35 data MyOptions = MyOptions { run :: Mode
37 , iniFile :: Maybe Text
39 deriving (Generic, Show)
41 instance ParseRecord MyOptions
46 MyOptions myMode myPort myIniFile <- getRecord
47 "Gargantext: collaborative platform for text-mining"
49 let myPort' = case myPort of
53 let start = case myMode of
54 --Nothing -> startGargantext myPort' (unpack myIniFile')
55 Prod -> startGargantext myPort' (unpack myIniFile')
57 myIniFile' = case myIniFile of
58 Nothing -> panic "Need gargantext.ini file"
60 Mock -> startGargantextMock myPort'
61 Dev -> startGargantextMock myPort'
63 putStrLn $ "Starting Gargantext with mode: " <> show myMode