Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
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
Przemyslaw Kaminski
haskell-gargantext
Commits
340d3a46
Commit
340d3a46
authored
Mar 18, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[version] add version info
NOTE: API doesn't compile yet.
parent
dad36dd5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
Main.hs
bin/gargantext-server/Main.hs
+13
-3
docker-compose.yaml
devops/docker/docker-compose.yaml
+1
-0
API.hs
src/Gargantext/API.hs
+10
-1
No files found.
bin/gargantext-server/Main.hs
View file @
340d3a46
...
...
@@ -22,9 +22,11 @@ Script to start gargantext with different modes (Dev, Prod, Mock).
module
Main
where
import
Options.Generic
import
Data.Version
(
showVersion
)
import
Data.Text
(
unpack
)
import
qualified
Paths_gargantext
as
PG
-- cabal magic build module
import
Options.Generic
import
System.Exit
(
exitSuccess
)
import
Gargantext.Prelude
import
Gargantext.API
(
startGargantext
)
-- , startGargantextMock)
...
...
@@ -51,6 +53,8 @@ data MyOptions w =
<?>
"By default: 8008"
,
ini
::
w
:::
Maybe
Text
<?>
"Ini-file path of gargantext.ini"
,
version
::
w
:::
Bool
<?>
"Show version number and exit"
}
deriving
(
Generic
)
...
...
@@ -60,9 +64,15 @@ deriving instance Show (MyOptions Unwrapped)
main
::
IO
()
main
=
do
MyOptions
myMode
myPort
myIniFile
<-
unwrapRecord
MyOptions
myMode
myPort
myIniFile
myVersion
<-
unwrapRecord
"Gargantext server"
if
myVersion
then
do
putStrLn
$
"Version: "
<>
showVersion
PG
.
version
System
.
Exit
.
exitSuccess
else
return
()
let
myPort'
=
case
myPort
of
Just
p
->
p
Nothing
->
8008
...
...
devops/docker/docker-compose.yaml
View file @
340d3a46
...
...
@@ -3,6 +3,7 @@ version: '3'
services
:
postgres
:
image
:
'
postgres:latest'
network_mode
:
host
ports
:
-
5432:5432
environment
:
...
...
src/Gargantext/API.hs
View file @
340d3a46
...
...
@@ -57,10 +57,12 @@ import Data.Aeson.Encode.Pretty (encodePretty)
import
Data.Swagger
import
Data.Text
(
Text
)
import
Data.Validity
import
Data.Version
(
showVersion
)
import
GHC.Generics
(
D1
,
Meta
(
..
),
Rep
)
import
GHC.TypeLits
(
AppendSymbol
,
Symbol
)
import
Network.Wai
import
Network.Wai.Handler.Warp
hiding
(
defaultSettings
)
import
qualified
Paths_gargantext
as
PG
-- cabal magic build module
import
Servant
import
Servant.Auth
as
SA
import
Servant.Auth.Server
(
AuthResult
(
..
))
...
...
@@ -204,6 +206,8 @@ type GargAPI' =
"auth"
:>
Summary
"AUTH API"
:>
ReqBody
'[
J
SON
]
AuthRequest
:>
Post
'[
J
SON
]
AuthResponse
:<|>
"version"
:>
Summary
"Backend version"
:>
Get
'[
J
SON
]
Text
-- TODO-ACCESS here we want to request a particular header for
-- auth and capabilities.
:<|>
GargPrivateAPI
...
...
@@ -345,9 +349,14 @@ server env = do
serverGargAPI
::
GargServerT
env
err
(
GargServerM
env
err
)
GargAPI
serverGargAPI
-- orchestrator
=
auth
:<|>
serverPrivateGargAPI
=
auth
:<|>
gargVersion
:<|>
serverPrivateGargAPI
-- :<|> orchestrator
gargVersion
::
GargServer
Text
gargVersion
=
pure
$
(
showVersion
PG
.
version
::
Text
)
serverPrivateGargAPI
::
GargServerT
env
err
(
GargServerM
env
err
)
GargPrivateAPI
serverPrivateGargAPI
(
Authenticated
auser
)
=
serverPrivateGargAPI'
auser
serverPrivateGargAPI
_
=
throwAll'
(
_ServerError
#
err401
)
...
...
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