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
159
Issues
159
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
ffd91184
Commit
ffd91184
authored
Mar 30, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ENV/DEVENV] Adding HasSettings class and instances (Reader).
parent
d1a3103e
Pipeline
#313
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
API.hs
src/Gargantext/API.hs
+2
-2
Node.hs
src/Gargantext/API/Node.hs
+3
-3
Settings.hs
src/Gargantext/API/Settings.hs
+11
-0
No files found.
src/Gargantext/API.hs
View file @
ffd91184
...
...
@@ -278,7 +278,7 @@ type API = SwaggerFrontAPI :<|> GargAPI :<|> Get '[HTML] Html
---------------------------------------------------------------------
-- | Server declarations
server
::
(
HasConnection
env
,
HasRepo
env
)
server
::
(
HasConnection
env
,
HasRepo
env
,
HasSettings
env
)
=>
env
->
IO
(
Server
API
)
server
env
=
do
-- orchestrator <- scrapyOrchestrator env
...
...
@@ -318,7 +318,7 @@ gargMock :: Server GargAPI
gargMock
=
mock
apiGarg
Proxy
---------------------------------------------------------------------
makeApp
::
(
HasConnection
env
,
HasRepo
env
)
makeApp
::
(
HasConnection
env
,
HasRepo
env
,
HasSettings
env
)
=>
env
->
IO
Application
makeApp
=
fmap
(
serve
api
)
.
server
...
...
src/Gargantext/API/Node.hs
View file @
ffd91184
...
...
@@ -75,7 +75,7 @@ import qualified Data.Vector as Vec
type
GargServer
api
=
forall
env
m
.
(
CmdM
env
ServantErr
m
,
HasRepo
env
)
(
CmdM
env
ServantErr
m
,
HasRepo
env
,
HasSettings
env
)
=>
ServerT
api
m
-------------------------------------------------------------------
...
...
@@ -406,11 +406,11 @@ getMetrics cId maybeListId tabType maybeLimit = do
listType
t
m
=
maybe
(
panic
errorMsg
)
fst
$
Map
.
lookup
t
m
errorMsg
=
"API.Node.metrics: key absent"
{-
--
{-
let
metrics'
=
Map
.
fromListWith
(
<>
)
$
map
(
\
(
Metric
_
s1
s2
lt
)
->
(
lt
,
[
Vec
.
fromList
[
s1
,
s2
]]))
metrics
_
<-
liftIO
$
Learn
.
grid
metrics'
en
<-
ask
printDebug "path" $ _fileFolder $
_env_s
ettings en
printDebug
"path"
$
_fileFolder
$
view
repoS
ettings
en
--}
pure
$
Metrics
metrics
...
...
src/Gargantext/API/Settings.hs
View file @
ffd91184
...
...
@@ -85,6 +85,9 @@ data Settings = Settings
makeLenses
''
S
ettings
class
HasSettings
env
where
repoSettings
::
Getter
env
Settings
parseJwk
::
Text
->
Jose
.
Jwk
parseJwk
secretStr
=
jwk
...
...
@@ -162,6 +165,9 @@ instance HasRepoSaver Env where
instance
HasRepo
Env
where
repoEnv
=
env_repo
instance
HasSettings
Env
where
repoSettings
=
env_settings
data
MockEnv
=
MockEnv
{
_menv_firewall
::
!
FireWall
}
...
...
@@ -251,6 +257,7 @@ newEnv port file = do
data
DevEnv
=
DevEnv
{
_dev_env_conn
::
!
Connection
,
_dev_env_repo
::
!
RepoEnv
,
_dev_env_settings
::
!
Settings
}
makeLenses
''
D
evEnv
...
...
@@ -267,6 +274,9 @@ instance HasRepoSaver DevEnv where
instance
HasRepo
DevEnv
where
repoEnv
=
dev_env_repo
instance
HasSettings
DevEnv
where
repoSettings
=
dev_env_settings
cleanEnv
::
HasRepo
env
=>
env
->
IO
()
cleanEnv
env
=
do
r
<-
takeMVar
(
env
^.
repoEnv
.
renv_var
)
...
...
@@ -286,6 +296,7 @@ withDevEnv iniPath k = do
pure
$
DevEnv
{
_dev_env_conn
=
conn
,
_dev_env_repo
=
repo
,
_dev_env_settings
=
devSettings
}
-- | Run Cmd Sugar for the Repl (GHCI)
...
...
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