Commit 5097fc6d authored by Alexandre Delanoë's avatar Alexandre Delanoë

[COMMAND LINe] improve optiosn to run at startup.

parent 193325e6
......@@ -16,6 +16,8 @@ Portability : POSIX
module Main where
import Prelude (putStrLn)
import Options.Generic
import Data.Text (unpack)
......@@ -30,34 +32,33 @@ instance ParseRecord Mode
instance ParseField Mode
instance ParseFields Mode
data MyOptions = MyOptions { port :: Maybe Int
data MyOptions = MyOptions { run :: Mode
, port :: Maybe Int
, iniFile :: Maybe Text
, mode :: Maybe Mode
}
deriving (Generic, Show)
instance ParseRecord MyOptions
main :: IO ()
main = do
MyOptions myPort myIniFile myMode <- getRecord
MyOptions myMode myPort myIniFile <- getRecord
"Gargantext: collaborative platform for text-mining"
let myPort' = case myPort of
Just p -> p
Nothing -> 8008
let start = case myMode of
--Nothing -> startGargantext myPort' (unpack myIniFile')
Just Prod -> startGargantext myPort' (unpack myIniFile')
Prod -> startGargantext myPort' (unpack myIniFile')
where
myIniFile' = case myIniFile of
Nothing -> panic "Need gargantext.ini file"
Just i -> i
Just Mock -> startGargantextMock myPort'
_ -> startGargantextMock myPort'
Mock -> startGargantextMock myPort'
Dev -> startGargantextMock myPort'
putStrLn $ "Starting Gargantext with mode: " <> show myMode
start
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment