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
8bbeb216
Verified
Commit
8bbeb216
authored
Sep 18, 2024
by
Przemyslaw Kaminski
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[settings] loglevel moved to garg config
parent
0902bab3
Pipeline
#6664
passed with stages
in 63 minutes and 39 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
82 deletions
+12
-82
Ini.hs
bin/gargantext-cli/CLI/Ini.hs
+2
-1
gargantext.cabal
gargantext.cabal
+1
-0
Settings.hs
src/Gargantext/API/Admin/Settings.hs
+1
-3
CORS.hs
src/Gargantext/API/Admin/Settings/CORS.hs
+0
-43
MicroServices.hs
src/Gargantext/API/Admin/Settings/MicroServices.hs
+0
-31
Types.hs
src/Gargantext/API/Admin/Types.hs
+2
-3
Config.hs
src/Gargantext/Core/Config.hs
+6
-1
No files found.
bin/gargantext-cli/CLI/Ini.hs
View file @
8bbeb216
...
...
@@ -19,6 +19,7 @@ Import a corpus binary.
module
CLI.Ini
where
import
CLI.Types
import
Control.Monad.Logger
(
LogLevel
(
LevelDebug
))
import
Data.Text
qualified
as
T
import
Database.PostgreSQL.Simple
qualified
as
PGS
import
Gargantext.Core.Config
qualified
as
Config
...
...
@@ -73,7 +74,7 @@ convertConfigs ini@(Ini.GargConfig { .. }) iniMail nlpConfig connInfo =
,
_jc_js_id_timeout
=
_gc_js_id_timeout
}
,
_gc_apis
=
CTypes
.
APIsConfig
{
_ac_pubmed_api_key
=
_gc_pubmed_api_key
,
_ac_epo_api_url
=
_gc_epo_api_url
}
,
_gc_log_level
=
LevelDebug
}
mkFrontendConfig
::
Ini
.
GargConfig
->
CTypes
.
FrontendConfig
...
...
gargantext.cabal
View file @
8bbeb216
...
...
@@ -659,6 +659,7 @@ executable gargantext-cli
, gargantext
, gargantext-prelude
, ini ^>= 0.4.1
, monad-logger ^>= 0.3.36
, optparse-applicative
, optparse-generic ^>= 1.4.7
, parallel ^>= 3.2.2.0
...
...
src/Gargantext/API/Admin/Settings.hs
View file @
8bbeb216
...
...
@@ -20,7 +20,6 @@ module Gargantext.API.Admin.Settings
import
Codec.Serialise
(
Serialise
(),
serialise
)
import
Control.Lens
import
Control.Monad.Logger
(
LogLevel
(
..
))
import
Control.Monad.Reader
import
Data.ByteString.Lazy
qualified
as
L
import
Data.Pool
(
Pool
)
...
...
@@ -68,9 +67,8 @@ devSettings (JwkFile jwkFile) = do
pure
$
Settings
{
-- _corsSettings = _gargCorsSettings
-- , _microservicesSettings = _gargMicroServicesSettings
_logLevelLimit
=
LevelDebug
-- , _dbServer = "localhost"
,
_sendLoginEmails
=
LogEmailToConsole
_sendLoginEmails
=
LogEmailToConsole
,
_scrapydUrl
=
fromMaybe
(
panicTrace
"Invalid scrapy URL"
)
$
parseBaseUrl
"http://localhost:6800"
,
_cookieSettings
=
defaultCookieSettings
{
cookieXsrfSetting
=
Just
xsrfCookieSetting
}
-- TODO-SECURITY tune
,
_jwtSettings
=
defaultJWTSettings
jwk
-- TODO-SECURITY tune
...
...
src/Gargantext/API/Admin/Settings/CORS.hs
deleted
100644 → 0
View file @
0902bab3
{--| Support in Gargantext for CORS (Cross-origin resource sharing) --}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ViewPatterns #-}
module
Gargantext.API.Admin.Settings.CORS
where
import
Prelude
import
Control.Arrow
import
Data.Text
qualified
as
T
import
Toml
import
Control.Lens
hiding
(
iso
,
(
.=
))
import
Servant.Client.Core
import
Data.Maybe
(
fromMaybe
)
newtype
CORSOrigin
=
CORSOrigin
{
_CORSOrigin
::
BaseUrl
}
deriving
(
Show
,
Eq
)
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
)
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/API/Admin/Settings/MicroServices.hs
deleted
100644 → 0
View file @
0902bab3
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.API.Admin.Settings.MicroServices
where
import
Prelude
import
Control.Lens.TH
import
Data.Text
qualified
as
T
import
Gargantext.Core.Config
import
Servant.Client.Core.BaseUrl
import
Toml
data
MicroServicesSettings
=
MicroServicesSettings
{
-- | The port where the microservices proxy will be listening on.
_msProxyPort
::
!
Int
,
_msProxyEnabled
::
!
Bool
}
deriving
(
Show
,
Eq
)
microServicesSettingsCodec
::
TomlCodec
MicroServicesSettings
microServicesSettingsCodec
=
MicroServicesSettings
<$>
Toml
.
int
"port"
.=
_msProxyPort
<*>
Toml
.
bool
"enabled"
.=
_msProxyEnabled
mkProxyUrl
::
GargConfig
->
MicroServicesSettings
->
BaseUrl
mkProxyUrl
GargConfig
{
..
}
MicroServicesSettings
{
..
}
=
case
parseBaseUrl
(
T
.
unpack
_gc_url
)
of
Nothing
->
BaseUrl
Http
"localhost"
80
""
Just
bh
->
bh
{
baseUrlPort
=
_msProxyPort
}
makeLenses
''
M
icroServicesSettings
src/Gargantext/API/Admin/Types.hs
View file @
8bbeb216
...
...
@@ -3,7 +3,6 @@
module
Gargantext.API.Admin.Types
where
import
Control.Lens
import
Control.Monad.Logger
(
LogLevel
)
import
GHC.Enum
import
Gargantext.Prelude
import
Servant.Auth.Server
(
JWTSettings
,
CookieSettings
(
..
))
...
...
@@ -17,10 +16,10 @@ data SendEmailType = SendEmailViaAws
deriving
(
Show
,
Read
,
Enum
,
Bounded
,
Generic
)
data
Settings
=
Settings
{
_logLevelLimit
::
!
LogLevel
-- log level from the monad-logger package
{
-- , _dbServer :: Text
-- ^ this is not used yet
,
_jwtSettings
::
!
JWTSettings
_jwtSettings
::
!
JWTSettings
,
_cookieSettings
::
!
CookieSettings
,
_sendLoginEmails
::
!
SendEmailType
,
_scrapydUrl
::
!
BaseUrl
...
...
src/Gargantext/Core/Config.hs
View file @
8bbeb216
...
...
@@ -28,10 +28,12 @@ module Gargantext.Core.Config (
,
gc_jobs
,
gc_secrets
,
gc_apis
,
gc_log_level
,
mkProxyUrl
)
where
import
Control.Monad.Logger
(
LogLevel
(
LevelDebug
))
import
Data.Text
as
T
import
Database.PostgreSQL.Simple
qualified
as
PSQL
import
Gargantext.Core.Config.Mail
(
MailConfig
)
...
...
@@ -59,6 +61,7 @@ data GargConfig = GargConfig { _gc_datafilepath :: ~FilePath
,
_gc_jobs
::
~
JobsConfig
,
_gc_secrets
::
~
SecretsConfig
,
_gc_apis
::
~
APIsConfig
,
_gc_log_level
::
~
LogLevel
}
deriving
(
Generic
,
Show
)
...
...
@@ -76,6 +79,7 @@ instance FromValue GargConfig where
_gc_jobs
<-
reqKey
"jobs"
_gc_apis
<-
reqKey
"apis"
_gc_notifications_config
<-
reqKey
"notifications"
let
_gc_log_level
=
LevelDebug
return
$
GargConfig
{
_gc_datafilepath
,
_gc_jobs
,
_gc_apis
...
...
@@ -85,7 +89,8 @@ instance FromValue GargConfig where
,
_gc_nlp_config
,
_gc_notifications_config
,
_gc_frames
,
_gc_secrets
}
,
_gc_secrets
,
_gc_log_level
}
instance
ToValue
GargConfig
where
toValue
=
defaultTableToValue
instance
ToTable
GargConfig
where
...
...
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