Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
651caaee
Commit
651caaee
authored
Sep 23, 2024
by
Alexandre Delanoë
1
Browse files
Options
Browse Files
Download
Plain Diff
Missing merge
parents
5fd34f93
5d50f716
Pipeline
#6682
canceled with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
12 deletions
+16
-12
Ini.hs
bin/gargantext-cli/CLI/Ini.hs
+13
-10
Types.hs
bin/gargantext-cli/CLI/Types.hs
+2
-1
NLP.hs
src/Gargantext/Core/Config/Ini/NLP.hs
+1
-1
No files found.
bin/gargantext-cli/CLI/Ini.hs
View file @
651caaee
...
@@ -20,6 +20,7 @@ module CLI.Ini where
...
@@ -20,6 +20,7 @@ module CLI.Ini where
import
CLI.Types
import
CLI.Types
import
Data.Text
qualified
as
T
import
Data.Text
qualified
as
T
import
Data.Text.IO
qualified
as
T
(
writeFile
)
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Core.Config
qualified
as
Config
import
Gargantext.Core.Config
qualified
as
Config
import
Gargantext.Core.Config.Ini.Ini
qualified
as
Ini
import
Gargantext.Core.Config.Ini.Ini
qualified
as
Ini
...
@@ -33,24 +34,26 @@ import Toml qualified
...
@@ -33,24 +34,26 @@ import Toml qualified
iniCLI
::
IniArgs
->
IO
()
iniCLI
::
IniArgs
->
IO
()
iniCLI
(
IniArgs
iniPath
)
=
do
iniCLI
iniArgs
=
do
-- putStrLn $ "ini path: " <> iniPath
let
iniPath
=
fromMaybe
"gargantext.ini"
$
ini_path
iniArgs
let
tomlPath
=
fromMaybe
"gargantext-settings.toml"
$
toml_path
iniArgs
putStrLn
$
"Reading configuration from file "
<>
iniPath
<>
"..."
ini
<-
Ini
.
readConfig
iniPath
ini
<-
Ini
.
readConfig
iniPath
iniMail
<-
IniMail
.
readConfig
iniPath
iniMail
<-
IniMail
.
readConfig
iniPath
iniNLP
<-
IniNLP
.
readConfig
iniPath
iniNLP
<-
IniNLP
.
readConfig
iniPath
-- putStrLn (show ini :: Text)
connInfo
<-
Ini
.
readDBConfig
iniPath
connInfo
<-
Ini
.
readDBConfig
iniPath
let
c
=
convertConfigs
ini
iniMail
iniNLP
connInfo
let
c
=
convertConfigs
ini
iniMail
iniNLP
connInfo
-- putStrLn (show c
:: Text)
T
.
writeFile
tomlPath
(
show
(
Toml
.
encode
c
)
::
Text
)
putStrLn
(
show
(
Toml
.
encode
c
)
::
Text
)
putStrLn
$
"Converted configuration into TOML and wrote it to file "
<>
tomlPath
iniCmd
::
HasCallStack
=>
Mod
CommandFields
CLI
iniCmd
::
HasCallStack
=>
Mod
CommandFields
CLI
iniCmd
=
command
"ini"
(
info
(
helper
<*>
fmap
CLISub
ini_p
)
(
progDesc
"Parse .ini file and output a corresponding .toml file."
))
iniCmd
=
command
"ini"
(
info
(
helper
<*>
fmap
CLISub
iniParser
)
(
progDesc
"Parse .ini file and output a corresponding .toml file."
))
ini
_p
::
Parser
CLICmd
ini
Parser
::
Parser
CLICmd
ini
_p
=
fmap
CCMD_ini
$
IniArgs
ini
Parser
=
fmap
CCMD_ini
$
IniArgs
<$>
<$>
strOption
(
long
"ini-path"
(
optional
.
strOption
$
long
"ini-path"
<>
help
"Path to the input ini file"
)
<*>
<>
help
"Path to ini file"
)
(
optional
.
strOption
$
long
"toml-path"
<>
help
"Path to the output .toml file"
)
convertConfigs
::
Ini
.
GargConfig
->
IniMail
.
MailConfig
->
IniNLP
.
NLPConfig
->
PGS
.
ConnectInfo
->
Config
.
GargConfig
convertConfigs
::
Ini
.
GargConfig
->
IniMail
.
MailConfig
->
IniNLP
.
NLPConfig
->
PGS
.
ConnectInfo
->
Config
.
GargConfig
convertConfigs
ini
@
(
Ini
.
GargConfig
{
..
})
iniMail
nlpConfig
connInfo
=
convertConfigs
ini
@
(
Ini
.
GargConfig
{
..
})
iniMail
nlpConfig
connInfo
=
...
...
bin/gargantext-cli/CLI/Types.hs
View file @
651caaee
...
@@ -46,7 +46,8 @@ data ImportArgs = ImportArgs
...
@@ -46,7 +46,8 @@ data ImportArgs = ImportArgs
}
deriving
(
Show
,
Eq
)
}
deriving
(
Show
,
Eq
)
data
IniArgs
=
IniArgs
data
IniArgs
=
IniArgs
{
ini_path
::
!
FilePath
{
ini_path
::
!
(
Maybe
FilePath
)
,
toml_path
::
!
(
Maybe
FilePath
)
}
deriving
(
Show
,
Eq
)
}
deriving
(
Show
,
Eq
)
data
InitArgs
=
InitArgs
data
InitArgs
=
InitArgs
...
...
src/Gargantext/Core/Config/Ini/NLP.hs
View file @
651caaee
...
@@ -47,7 +47,7 @@ readConfig fp = do
...
@@ -47,7 +47,7 @@ readConfig fp = do
let
m_nlp_default
=
parseURI
$
cs
$
val'
lang_default_text
let
m_nlp_default
=
parseURI
$
cs
$
val'
lang_default_text
let
m_nlp_keys
=
f
ilter
(
\
k
->
k
`
notElem
`
[
lang_default_text
])
$
f
romRight
[]
$
Ini
.
keys
iniSection
ini
let
m_nlp_keys
=
fromRight
[]
$
Ini
.
keys
iniSection
ini
let
m_nlp_other
=
listToMaybeAll
$
(
\
k
->
(,)
k
<$>
(
parseURI
$
cs
$
val'
k
))
<$>
m_nlp_keys
let
m_nlp_other
=
listToMaybeAll
$
(
\
k
->
(,)
k
<$>
(
parseURI
$
cs
$
val'
k
))
<$>
m_nlp_keys
let
mRet
=
NLPConfig
<$>
m_nlp_default
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
let
mRet
=
NLPConfig
<$>
m_nlp_default
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
...
...
Przemyslaw Kaminski
@cgenie
mentioned in commit
5660aec0
·
Oct 08, 2024
mentioned in commit
5660aec0
mentioned in commit 5660aec07ec5a0a0a5468f440092c1a8f57a864e
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment