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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Christian Merten
haskell-gargantext
Commits
86ab220b
Verified
Commit
86ab220b
authored
Aug 28, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[toml] implement full config, refactoring of types
Also, tests pass now, locally
parent
3e499383
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
198 additions
and
223 deletions
+198
-223
gargantext.cabal
gargantext.cabal
+0
-4
API.hs
src/Gargantext/API.hs
+1
-3
Settings.hs
src/Gargantext/API/Admin/Settings.hs
+3
-4
Types.hs
src/Gargantext/API/Admin/Types.hs
+1
-2
Config.hs
src/Gargantext/Core/Config.hs
+20
-17
CORS.hs
src/Gargantext/Core/Config/CORS.hs
+0
-56
Database.hs
src/Gargantext/Core/Config/Database.hs
+0
-55
Frontend.hs
src/Gargantext/Core/Config/Frontend.hs
+0
-44
Mail.hs
src/Gargantext/Core/Config/Mail.hs
+1
-1
MicroServices.hs
src/Gargantext/Core/Config/MicroServices.hs
+0
-35
Types.hs
src/Gargantext/Core/Config/Types.hs
+171
-1
Node.hs
src/Gargantext/Database/Action/Node.hs
+1
-1
test_config.toml.jobs
test-data/test_config.toml.jobs
+0
-0
No files found.
gargantext.cabal
View file @
86ab220b
...
@@ -175,11 +175,7 @@ library
...
@@ -175,11 +175,7 @@ library
Gargantext.Core.AsyncUpdates.Dispatcher.WebSocket
Gargantext.Core.AsyncUpdates.Dispatcher.WebSocket
Gargantext.Core.AsyncUpdates.Nanomsg
Gargantext.Core.AsyncUpdates.Nanomsg
Gargantext.Core.Config
Gargantext.Core.Config
Gargantext.Core.Config.CORS
Gargantext.Core.Config.Database
Gargantext.Core.Config.Frontend
Gargantext.Core.Config.Mail
Gargantext.Core.Config.Mail
Gargantext.Core.Config.MicroServices
Gargantext.Core.Config.NLP
Gargantext.Core.Config.NLP
Gargantext.Core.Config.Types
Gargantext.Core.Config.Types
Gargantext.Core.Config.Utils
Gargantext.Core.Config.Utils
...
...
src/Gargantext/API.hs
View file @
86ab220b
...
@@ -52,9 +52,7 @@ import Gargantext.API.Routes.Named (API)
...
@@ -52,9 +52,7 @@ import Gargantext.API.Routes.Named (API)
import
Gargantext.API.Routes.Named.EKG
import
Gargantext.API.Routes.Named.EKG
import
Gargantext.API.Server.Named
(
server
)
import
Gargantext.API.Server.Named
(
server
)
import
Gargantext.Core.AsyncUpdates.Constants
qualified
as
AUConstants
import
Gargantext.Core.AsyncUpdates.Constants
qualified
as
AUConstants
import
Gargantext.Core.Config.CORS
import
Gargantext.Core.Config.Types
(
CORSOrigin
(
..
),
CORSSettings
,
SettingsFile
(
..
),
corsAllowedOrigins
,
msProxyPort
)
import
Gargantext.Core.Config.MicroServices
import
Gargantext.Core.Config.Types
(
SettingsFile
(
..
))
import
Gargantext.Database.Prelude
qualified
as
DB
import
Gargantext.Database.Prelude
qualified
as
DB
import
Gargantext.MicroServices.ReverseProxy
(
microServicesProxyApp
)
import
Gargantext.MicroServices.ReverseProxy
(
microServicesProxyApp
)
import
Gargantext.Prelude
hiding
(
putStrLn
)
import
Gargantext.Prelude
hiding
(
putStrLn
)
...
...
src/Gargantext/API/Admin/Settings.hs
View file @
86ab220b
...
@@ -33,8 +33,7 @@ import Gargantext.API.Prelude
...
@@ -33,8 +33,7 @@ import Gargantext.API.Prelude
import
Gargantext.Core.AsyncUpdates.CentralExchange
qualified
as
CE
import
Gargantext.Core.AsyncUpdates.CentralExchange
qualified
as
CE
import
Gargantext.Core.AsyncUpdates.Dispatcher
qualified
as
D
import
Gargantext.Core.AsyncUpdates.Dispatcher
qualified
as
D
import
Gargantext.Core.Config
(
GargConfig
(
..
),
gc_js_job_timeout
,
gc_js_id_timeout
)
import
Gargantext.Core.Config
(
GargConfig
(
..
),
gc_js_job_timeout
,
gc_js_id_timeout
)
import
Gargantext.Core.Config.Frontend
qualified
as
Frontend
import
Gargantext.Core.Config.Types
(
SettingsFile
(
..
),
_fc_cors
,
_fc_microservices
)
import
Gargantext.Core.Config.Types
(
SettingsFile
(
..
))
import
Gargantext.Core.Config.Utils
(
readConfig
)
import
Gargantext.Core.Config.Utils
(
readConfig
)
import
Gargantext.Core.NLP
(
nlpServerMap
)
import
Gargantext.Core.NLP
(
nlpServerMap
)
import
Gargantext.Core.NodeStory
import
Gargantext.Core.NodeStory
...
@@ -69,9 +68,9 @@ devSettings (JwkFile jwkFile) settingsFile = do
...
@@ -69,9 +68,9 @@ devSettings (JwkFile jwkFile) settingsFile = do
gc
@
(
GargConfig
{})
<-
readConfig
settingsFile
gc
@
(
GargConfig
{})
<-
readConfig
settingsFile
pure
$
Settings
pure
$
Settings
{
-- _corsSettings = _gargCorsSettings
{
-- _corsSettings = _gargCorsSettings
_corsSettings
=
Frontend
.
_fc_cors
$
_gc_frontend_config
gc
_corsSettings
=
_fc_cors
$
_gc_frontend_config
gc
-- , _microservicesSettings = _gargMicroServicesSettings
-- , _microservicesSettings = _gargMicroServicesSettings
,
_microservicesSettings
=
Frontend
.
_fc_microservices
$
_gc_frontend_config
gc
,
_microservicesSettings
=
_fc_microservices
$
_gc_frontend_config
gc
,
_appPort
=
3000
,
_appPort
=
3000
,
_logLevelLimit
=
LevelDebug
,
_logLevelLimit
=
LevelDebug
-- , _dbServer = "localhost"
-- , _dbServer = "localhost"
...
...
src/Gargantext/API/Admin/Types.hs
View file @
86ab220b
...
@@ -5,8 +5,7 @@ module Gargantext.API.Admin.Types where
...
@@ -5,8 +5,7 @@ module Gargantext.API.Admin.Types where
import
Control.Lens
import
Control.Lens
import
Control.Monad.Logger
(
LogLevel
)
import
Control.Monad.Logger
(
LogLevel
)
import
GHC.Enum
import
GHC.Enum
import
Gargantext.Core.Config.CORS
import
Gargantext.Core.Config.Types
import
Gargantext.Core.Config.MicroServices
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Servant.Auth.Server
(
JWTSettings
,
CookieSettings
(
..
))
import
Servant.Auth.Server
(
JWTSettings
,
CookieSettings
(
..
))
import
Servant.Client
(
BaseUrl
)
import
Servant.Client
(
BaseUrl
)
...
...
src/Gargantext/Core/Config.hs
View file @
86ab220b
...
@@ -45,11 +45,9 @@ module Gargantext.Core.Config (
...
@@ -45,11 +45,9 @@ module Gargantext.Core.Config (
import
Data.Text
as
T
import
Data.Text
as
T
import
Database.PostgreSQL.Simple
qualified
as
PSQL
import
Database.PostgreSQL.Simple
qualified
as
PSQL
import
Gargantext.Core.Config.Database
(
TOMLConnectInfo
(
..
))
import
Gargantext.Core.Config.Frontend
(
FrontendConfig
(
..
))
import
Gargantext.Core.Config.Mail
(
MailConfig
)
import
Gargantext.Core.Config.Mail
(
MailConfig
)
import
Gargantext.Core.Config.MicroServices
(
MicroServicesSettings
(
..
))
import
Gargantext.Core.Config.NLP
(
NLPConfig
)
import
Gargantext.Core.Config.NLP
(
NLPConfig
)
import
Gargantext.Core.Config.Types
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Servant.Client
(
BaseUrl
(
..
),
Scheme
(
Http
),
parseBaseUrl
)
import
Servant.Client
(
BaseUrl
(
..
),
Scheme
(
Http
),
parseBaseUrl
)
import
Toml.Schema
import
Toml.Schema
...
@@ -101,23 +99,28 @@ instance FromValue GargConfig where
...
@@ -101,23 +99,28 @@ instance FromValue GargConfig where
_gc_mail_config
<-
reqKey
"mail"
_gc_mail_config
<-
reqKey
"mail"
db_config
<-
reqKey
"database"
db_config
<-
reqKey
"database"
_gc_nlp_config
<-
reqKey
"nlp"
_gc_nlp_config
<-
reqKey
"nlp"
secrets
<-
reqKey
"secrets"
_gc_datafilepath
<-
reqKeyOf
"paths"
$
parseTableFromValue
$
reqKey
"data_filepath"
frames
<-
reqKeyOf
"external"
$
parseTableFromValue
$
reqKey
"frames"
jobs
<-
reqKey
"jobs"
apis
<-
reqKey
"apis"
return
$
GargConfig
{
_gc_backend_name
=
_fc_backend_name
return
$
GargConfig
{
_gc_backend_name
=
_fc_backend_name
,
_gc_url
=
_fc_url
,
_gc_url
=
_fc_url
,
_gc_url_backend_api
=
_fc_url_backend_api
,
_gc_url_backend_api
=
_fc_url_backend_api
,
_gc_masteruser
=
""
,
_gc_masteruser
=
_s_master_user
secrets
,
_gc_secretkey
=
""
,
_gc_secretkey
=
_s_secret_key
secrets
,
_gc_datafilepath
=
""
,
_gc_datafilepath
,
_gc_frame_write_url
=
""
,
_gc_frame_write_url
=
_f_write_url
frames
,
_gc_frame_calc_url
=
""
,
_gc_frame_calc_url
=
_f_calc_url
frames
,
_gc_frame_visio_url
=
""
,
_gc_frame_visio_url
=
_f_visio_url
frames
,
_gc_frame_searx_url
=
""
,
_gc_frame_searx_url
=
_f_searx_url
frames
,
_gc_frame_istex_url
=
""
,
_gc_frame_istex_url
=
_f_istex_url
frames
,
_gc_max_docs_parsers
=
0
,
_gc_max_docs_parsers
=
_jc_max_docs_parsers
jobs
,
_gc_max_docs_scrapers
=
0
,
_gc_max_docs_scrapers
=
_jc_max_docs_scrapers
jobs
,
_gc_js_job_timeout
=
0
,
_gc_js_job_timeout
=
_jc_js_job_timeout
jobs
,
_gc_js_id_timeout
=
0
,
_gc_js_id_timeout
=
_jc_js_id_timeout
jobs
,
_gc_pubmed_api_key
=
""
,
_gc_pubmed_api_key
=
_ac_pubmed_api_key
apis
,
_gc_epo_api_url
=
""
,
_gc_epo_api_url
=
_ac_epo_api_url
apis
,
_gc_frontend_config
,
_gc_frontend_config
,
_gc_mail_config
,
_gc_mail_config
,
_gc_database_config
=
unTOMLConnectInfo
db_config
,
_gc_database_config
=
unTOMLConnectInfo
db_config
...
...
src/Gargantext/Core/Config/CORS.hs
deleted
100644 → 0
View file @
3e499383
{--| Support in Gargantext for CORS (Cross-origin resource sharing) --}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
module
Gargantext.Core.Config.CORS
where
import
Control.Monad.Fail
(
fail
)
import
Data.Text
qualified
as
T
import
Gargantext.Prelude
import
Servant.Client.Core
(
BaseUrl
,
parseBaseUrl
)
import
Toml
import
Toml.Schema
newtype
CORSOrigin
=
CORSOrigin
{
_CORSOrigin
::
BaseUrl
}
deriving
(
Show
,
Eq
)
instance
FromValue
CORSOrigin
where
fromValue
(
Toml
.
Text'
_
t
)
=
case
parseBaseUrl
(
T
.
unpack
t
)
of
Nothing
->
fail
$
"Cannot parse base url for: "
<>
T
.
unpack
t
Just
b
->
return
$
CORSOrigin
b
fromValue
_
=
fail
"Incorrect key type, expected Text"
data
CORSSettings
=
CORSSettings
{
_corsAllowedOrigins
::
[
CORSOrigin
]
,
_corsAllowedHosts
::
[
CORSOrigin
]
-- | If 'True', we will reuse the origin whitelist
-- as the allowed hosts as well. This allows, for example,
-- to connect from \"demo.gargantext.org\" to \"dev.sub.gargantext.org\"
-- and vice-versa.
,
_corsUseOriginsForHosts
::
!
Bool
}
deriving
(
Show
,
Eq
)
instance
FromValue
CORSSettings
where
fromValue
=
parseTableFromValue
$
do
_corsAllowedOrigins
<-
reqKey
"allowed-origins"
let
_corsAllowedHosts
=
mempty
_corsUseOriginsForHosts
<-
reqKey
"use-origins-for-hosts"
return
$
CORSSettings
{
..
}
-- corsOriginCodec :: TomlBiMap CORSOrigin AnyValue
-- corsOriginCodec = _Orig >>> _Text
-- where
-- _Orig :: BiMap e CORSOrigin T.Text
-- _Orig = iso (T.pack . showBaseUrl . _CORSOrigin)
-- (\(T.unpack -> u) -> CORSOrigin . fromMaybe (error $ "invalid origin: " <> u) . parseBaseUrl $ u)
-- corsSettingsCodec :: TomlCodec CORSSettings
-- corsSettingsCodec = CORSSettings
-- <$> Toml.arrayOf corsOriginCodec "allowed-origins" .= _corsAllowedOrigins
-- <*> pure mempty -- FIXME(adn) Currently we don't need to support this field.
-- <*> Toml.bool "use-origins-for-hosts" .= _corsUseOriginsForHosts
makeLenses
''
C
ORSSettings
src/Gargantext/Core/Config/Database.hs
deleted
100644 → 0
View file @
3e499383
{-|
Module : Gargantext.Core.Config.Database
Description :
Copyright : (c) CNRS, 2024-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
module
Gargantext.Core.Config.Database
(
TOMLConnectInfo
(
..
)
)
where
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Prelude
import
Toml.Schema
newtype
TOMLConnectInfo
=
TOMLConnectInfo
{
unTOMLConnectInfo
::
PGS
.
ConnectInfo
}
instance
FromValue
TOMLConnectInfo
where
fromValue
=
parseTableFromValue
$
do
host
<-
reqKey
"host"
port
<-
reqKey
"port"
user
<-
reqKey
"user"
password
<-
reqKey
"pass"
db
<-
reqKey
"name"
return
$
TOMLConnectInfo
$
PGS
.
ConnectInfo
{
PGS
.
connectHost
=
host
,
PGS
.
connectPort
=
port
,
PGS
.
connectUser
=
user
,
PGS
.
connectPassword
=
password
,
PGS
.
connectDatabase
=
db
}
-- pgsCodec :: Toml.TomlCodec PGS.ConnectInfo
-- pgsCodec = PGS.ConnectInfo
-- <$> Toml.string "database.host" .= PGS.connectHost
-- <*> word16Toml "database.port" .= PGS.connectPort
-- <*> Toml.string "database.user" .= PGS.connectUser
-- <*> Toml.string "database.password" .= PGS.connectPassword
-- <*> Toml.string "database.name" .= PGS.connectDatabase
-- ini <- readIniFile' fp
-- let val' key = unpack $ val ini "database" key
-- let dbPortRaw = val' "DB_PORT"
-- let dbPort = case (readMaybe dbPortRaw :: Maybe Word16) of
-- Nothing -> panicTrace $ "DB_PORT incorrect: " <> (pack dbPortRaw)
-- Just d -> d
-- pure $ PGS.ConnectInfo { PGS.connectHost = val' "DB_HOST"
-- , PGS.connectPort = dbPort
-- , PGS.connectUser = val' "DB_USER"
-- , PGS.connectPassword = val' "DB_PASS"
-- , PGS.connectDatabase = val' "DB_NAME"
-- }
src/Gargantext/Core/Config/Frontend.hs
deleted
100644 → 0
View file @
3e499383
{-|
Module : Gargantext.Core.Config.Frontend
Description :
Copyright : (c) CNRS, 2024-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Core.Config.Frontend
(
-- * Types
FrontendConfig
(
..
)
)
where
import
Gargantext.Core.Config.CORS
(
CORSSettings
)
import
Gargantext.Core.Config.MicroServices
(
MicroServicesSettings
)
import
Gargantext.Prelude
import
Toml.Schema
data
FrontendConfig
=
FrontendConfig
{
_fc_url
::
!
Text
,
_fc_backend_name
::
!
Text
,
_fc_url_backend_api
::
!
Text
,
_fc_jwt_settings
::
!
Text
,
_fc_cors
::
!
CORSSettings
,
_fc_microservices
::
!
MicroServicesSettings
}
deriving
(
Generic
,
Show
)
instance
FromValue
FrontendConfig
where
fromValue
=
parseTableFromValue
$
do
_fc_url
<-
reqKey
"url"
_fc_backend_name
<-
reqKey
"backend_name"
_fc_url_backend_api
<-
reqKey
"url_backend_api"
_fc_jwt_settings
<-
reqKey
"jwt_settings"
_fc_cors
<-
reqKey
"cors"
_fc_microservices
<-
reqKey
"microservices"
return
$
FrontendConfig
{
..
}
src/Gargantext/Core/Config/Mail.hs
View file @
86ab220b
...
@@ -70,7 +70,7 @@ data MailConfig = MailConfig { _mc_mail_host :: !T.Text
...
@@ -70,7 +70,7 @@ data MailConfig = MailConfig { _mc_mail_host :: !T.Text
instance
FromValue
MailConfig
where
instance
FromValue
MailConfig
where
fromValue
=
parseTableFromValue
$
do
fromValue
=
parseTableFromValue
$
do
_mc_mail_host
<-
reqKey
"
m-
host"
_mc_mail_host
<-
reqKey
"host"
port
<-
reqKey
"port"
::
ParseTable
l
Int
port
<-
reqKey
"port"
::
ParseTable
l
Int
_mc_mail_user
<-
reqKey
"user"
_mc_mail_user
<-
reqKey
"user"
_mc_mail_password
<-
reqKey
"password"
_mc_mail_password
<-
reqKey
"password"
...
...
src/Gargantext/Core/Config/MicroServices.hs
deleted
100644 → 0
View file @
3e499383
{-|
Module : Gargantext.Core.Config.MicroServices
Description :
Copyright : (c) CNRS, 2024-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Core.Config.MicroServices
where
import
Control.Lens.TH
import
Gargantext.Prelude
import
Toml.Schema
data
MicroServicesSettings
=
MicroServicesSettings
{
-- | The port where the microservices proxy will be listening on.
_msProxyPort
::
!
Int
,
_msProxyEnabled
::
!
Bool
}
deriving
(
Show
,
Eq
)
instance
FromValue
MicroServicesSettings
where
fromValue
=
parseTableFromValue
$
reqKeyOf
"proxy"
$
parseTableFromValue
$
do
_msProxyPort
<-
reqKey
"port"
_msProxyEnabled
<-
reqKey
"enabled"
return
$
MicroServicesSettings
{
..
}
makeLenses
''
M
icroServicesSettings
src/Gargantext/Core/Config/Types.hs
View file @
86ab220b
...
@@ -10,9 +10,179 @@ Portability : POSIX
...
@@ -10,9 +10,179 @@ Portability : POSIX
TODO-SECURITY: Critical
TODO-SECURITY: Critical
-}
-}
module
Gargantext.Core.Config.Types
where
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
module
Gargantext.Core.Config.Types
(
SettingsFile
(
..
)
,
CORSOrigin
(
..
)
,
CORSSettings
(
..
)
,
MicroServicesSettings
(
..
)
,
TOMLConnectInfo
(
..
)
,
FramesConfig
(
..
)
,
FrontendConfig
(
..
)
,
JobsConfig
(
..
)
,
APIsConfig
(
..
)
,
SecretsConfig
(
..
)
,
corsUseOriginsForHosts
,
corsAllowedOrigins
,
corsAllowedHosts
,
msProxyPort
,
msProxyEnabled
)
where
import
Control.Monad.Fail
(
fail
)
import
Data.Text
qualified
as
T
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Servant.Client.Core
(
BaseUrl
,
parseBaseUrl
)
import
Toml
import
Toml.Schema
newtype
SettingsFile
=
SettingsFile
{
_SettingsFile
::
FilePath
}
newtype
SettingsFile
=
SettingsFile
{
_SettingsFile
::
FilePath
}
deriving
(
Show
,
Eq
,
IsString
)
deriving
(
Show
,
Eq
,
IsString
)
newtype
CORSOrigin
=
CORSOrigin
{
_CORSOrigin
::
BaseUrl
}
deriving
(
Show
,
Eq
)
instance
FromValue
CORSOrigin
where
fromValue
(
Toml
.
Text'
_
t
)
=
case
parseBaseUrl
(
T
.
unpack
t
)
of
Nothing
->
fail
$
"Cannot parse base url for: "
<>
T
.
unpack
t
Just
b
->
return
$
CORSOrigin
b
fromValue
_
=
fail
"Incorrect key type, expected Text"
data
CORSSettings
=
CORSSettings
{
_corsAllowedOrigins
::
[
CORSOrigin
]
,
_corsAllowedHosts
::
[
CORSOrigin
]
-- | If 'True', we will reuse the origin whitelist
-- as the allowed hosts as well. This allows, for example,
-- to connect from \"demo.gargantext.org\" to \"dev.sub.gargantext.org\"
-- and vice-versa.
,
_corsUseOriginsForHosts
::
!
Bool
}
deriving
(
Show
,
Eq
)
instance
FromValue
CORSSettings
where
fromValue
=
parseTableFromValue
$
do
_corsAllowedOrigins
<-
reqKey
"allowed-origins"
let
_corsAllowedHosts
=
mempty
_corsUseOriginsForHosts
<-
reqKey
"use-origins-for-hosts"
return
$
CORSSettings
{
..
}
makeLenses
''
C
ORSSettings
data
MicroServicesSettings
=
MicroServicesSettings
{
-- | The port where the microservices proxy will be listening on.
_msProxyPort
::
!
Int
,
_msProxyEnabled
::
!
Bool
}
deriving
(
Show
,
Eq
)
instance
FromValue
MicroServicesSettings
where
fromValue
=
parseTableFromValue
$
reqKeyOf
"proxy"
$
parseTableFromValue
$
do
_msProxyPort
<-
reqKey
"port"
_msProxyEnabled
<-
reqKey
"enabled"
return
$
MicroServicesSettings
{
..
}
makeLenses
''
M
icroServicesSettings
newtype
TOMLConnectInfo
=
TOMLConnectInfo
{
unTOMLConnectInfo
::
PGS
.
ConnectInfo
}
instance
FromValue
TOMLConnectInfo
where
fromValue
=
parseTableFromValue
$
do
host
<-
reqKey
"host"
port
<-
reqKey
"port"
user
<-
reqKey
"user"
password
<-
reqKey
"pass"
db
<-
reqKey
"name"
return
$
TOMLConnectInfo
$
PGS
.
ConnectInfo
{
PGS
.
connectHost
=
host
,
PGS
.
connectPort
=
port
,
PGS
.
connectUser
=
user
,
PGS
.
connectPassword
=
password
,
PGS
.
connectDatabase
=
db
}
data
FramesConfig
=
FramesConfig
{
_f_write_url
::
Text
,
_f_calc_url
::
Text
,
_f_visio_url
::
Text
,
_f_searx_url
::
Text
,
_f_istex_url
::
Text
}
deriving
(
Generic
,
Show
)
instance
FromValue
FramesConfig
where
fromValue
=
parseTableFromValue
$
do
_f_write_url
<-
reqKey
"write_url"
_f_calc_url
<-
reqKey
"calc_url"
_f_visio_url
<-
reqKey
"visio_url"
_f_searx_url
<-
reqKey
"searx_url"
_f_istex_url
<-
reqKey
"istex_url"
return
$
FramesConfig
{
..
}
data
FrontendConfig
=
FrontendConfig
{
_fc_url
::
!
Text
,
_fc_backend_name
::
!
Text
,
_fc_url_backend_api
::
!
Text
,
_fc_jwt_settings
::
!
Text
,
_fc_cors
::
!
CORSSettings
,
_fc_microservices
::
!
MicroServicesSettings
}
deriving
(
Generic
,
Show
)
instance
FromValue
FrontendConfig
where
fromValue
=
parseTableFromValue
$
do
_fc_url
<-
reqKey
"url"
_fc_backend_name
<-
reqKey
"backend_name"
_fc_url_backend_api
<-
reqKey
"url_backend_api"
_fc_jwt_settings
<-
reqKey
"jwt_settings"
_fc_cors
<-
reqKey
"cors"
_fc_microservices
<-
reqKey
"microservices"
return
$
FrontendConfig
{
..
}
data
SecretsConfig
=
SecretsConfig
{
_s_master_user
::
!
Text
,
_s_secret_key
::
!
Text
}
deriving
(
Generic
,
Show
)
instance
FromValue
SecretsConfig
where
fromValue
=
parseTableFromValue
$
do
_s_master_user
<-
reqKey
"master_user"
_s_secret_key
<-
reqKey
"secret_key"
return
$
SecretsConfig
{
..
}
data
JobsConfig
=
JobsConfig
{
_jc_max_docs_parsers
::
!
Integer
,
_jc_max_docs_scrapers
::
!
Integer
,
_jc_js_job_timeout
::
!
Integer
,
_jc_js_id_timeout
::
!
Integer
}
instance
FromValue
JobsConfig
where
fromValue
=
parseTableFromValue
$
do
_jc_max_docs_parsers
<-
reqKey
"max_docs_parsers"
_jc_max_docs_scrapers
<-
reqKey
"max_docs_scrapers"
_jc_js_job_timeout
<-
reqKey
"js_job_timeout"
_jc_js_id_timeout
<-
reqKey
"js_id_timeout"
return
$
JobsConfig
{
..
}
data
APIsConfig
=
APIsConfig
{
_ac_pubmed_api_key
::
!
Text
,
_ac_epo_api_url
::
!
Text
}
instance
FromValue
APIsConfig
where
fromValue
=
parseTableFromValue
$
do
_ac_pubmed_api_key
<-
reqKeyOf
"pubmed"
$
parseTableFromValue
$
reqKey
"api_key"
_ac_epo_api_url
<-
reqKeyOf
"epo"
$
parseTableFromValue
$
reqKey
"api_url"
return
$
APIsConfig
{
..
}
src/Gargantext/Database/Action/Node.hs
View file @
86ab220b
...
@@ -25,7 +25,7 @@ import Data.Text qualified as T
...
@@ -25,7 +25,7 @@ import Data.Text qualified as T
import
Gargantext.API.Admin.Types
(
settings
,
_microservicesSettings
,
HasSettings
)
import
Gargantext.API.Admin.Types
(
settings
,
_microservicesSettings
,
HasSettings
)
import
Gargantext.Core
import
Gargantext.Core
import
Gargantext.Core.Config
(
GargConfig
(
..
),
mkProxyUrl
)
import
Gargantext.Core.Config
(
GargConfig
(
..
),
mkProxyUrl
)
import
Gargantext.Core.Config.
MicroServic
es
(
MicroServicesSettings
(
..
))
import
Gargantext.Core.Config.
Typ
es
(
MicroServicesSettings
(
..
))
import
Gargantext.Core.Types
(
Name
)
import
Gargantext.Core.Types
(
Name
)
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Hyperdata
import
Gargantext.Database.Admin.Types.Hyperdata.Default
import
Gargantext.Database.Admin.Types.Hyperdata.Default
...
...
test-data/test_config.toml.jobs
0 → 100644
View file @
86ab220b
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