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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
Hide 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
import
CLI.Types
import
Data.Text
qualified
as
T
import
Data.Text.IO
qualified
as
T
(
writeFile
)
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Core.Config
qualified
as
Config
import
Gargantext.Core.Config.Ini.Ini
qualified
as
Ini
...
...
@@ -33,24 +34,26 @@ import Toml qualified
iniCLI
::
IniArgs
->
IO
()
iniCLI
(
IniArgs
iniPath
)
=
do
-- putStrLn $ "ini path: " <> iniPath
iniCLI
iniArgs
=
do
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
iniMail
<-
IniMail
.
readConfig
iniPath
iniNLP
<-
IniNLP
.
readConfig
iniPath
-- putStrLn (show ini :: Text)
connInfo
<-
Ini
.
readDBConfig
iniPath
let
c
=
convertConfigs
ini
iniMail
iniNLP
connInfo
-- putStrLn (show c
:: Text)
putStrLn
(
show
(
Toml
.
encode
c
)
::
Text
)
T
.
writeFile
tomlPath
(
show
(
Toml
.
encode
c
)
::
Text
)
putStrLn
$
"Converted configuration into TOML and wrote it to file "
<>
tomlPath
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
_p
=
fmap
CCMD_ini
$
IniArgs
<$>
strOption
(
long
"ini-path"
<>
help
"Path to ini file"
)
ini
Parser
::
Parser
CLICmd
ini
Parser
=
fmap
CCMD_ini
$
IniArgs
<$>
(
optional
.
strOption
$
long
"ini-path"
<>
help
"Path to the input 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
@
(
Ini
.
GargConfig
{
..
})
iniMail
nlpConfig
connInfo
=
...
...
bin/gargantext-cli/CLI/Types.hs
View file @
651caaee
...
...
@@ -46,7 +46,8 @@ data ImportArgs = ImportArgs
}
deriving
(
Show
,
Eq
)
data
IniArgs
=
IniArgs
{
ini_path
::
!
FilePath
{
ini_path
::
!
(
Maybe
FilePath
)
,
toml_path
::
!
(
Maybe
FilePath
)
}
deriving
(
Show
,
Eq
)
data
InitArgs
=
InitArgs
...
...
src/Gargantext/Core/Config/Ini/NLP.hs
View file @
651caaee
...
...
@@ -47,7 +47,7 @@ readConfig fp = do
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
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