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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
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
Pipeline
#782
failed with stage
Changes
3
Pipelines
1
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).
...
@@ -22,9 +22,11 @@ Script to start gargantext with different modes (Dev, Prod, Mock).
module
Main
where
module
Main
where
import
Data.Version
(
showVersion
)
import
Options.Generic
import
Data.Text
(
unpack
)
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.Prelude
import
Gargantext.API
(
startGargantext
)
-- , startGargantextMock)
import
Gargantext.API
(
startGargantext
)
-- , startGargantextMock)
...
@@ -51,6 +53,8 @@ data MyOptions w =
...
@@ -51,6 +53,8 @@ data MyOptions w =
<?>
"By default: 8008"
<?>
"By default: 8008"
,
ini
::
w
:::
Maybe
Text
,
ini
::
w
:::
Maybe
Text
<?>
"Ini-file path of gargantext.ini"
<?>
"Ini-file path of gargantext.ini"
,
version
::
w
:::
Bool
<?>
"Show version number and exit"
}
}
deriving
(
Generic
)
deriving
(
Generic
)
...
@@ -60,9 +64,15 @@ deriving instance Show (MyOptions Unwrapped)
...
@@ -60,9 +64,15 @@ deriving instance Show (MyOptions Unwrapped)
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
MyOptions
myMode
myPort
myIniFile
<-
unwrapRecord
MyOptions
myMode
myPort
myIniFile
myVersion
<-
unwrapRecord
"Gargantext server"
"Gargantext server"
if
myVersion
then
do
putStrLn
$
"Version: "
<>
showVersion
PG
.
version
System
.
Exit
.
exitSuccess
else
return
()
let
myPort'
=
case
myPort
of
let
myPort'
=
case
myPort
of
Just
p
->
p
Just
p
->
p
Nothing
->
8008
Nothing
->
8008
...
...
devops/docker/docker-compose.yaml
View file @
340d3a46
...
@@ -3,6 +3,7 @@ version: '3'
...
@@ -3,6 +3,7 @@ version: '3'
services
:
services
:
postgres
:
postgres
:
image
:
'
postgres:latest'
image
:
'
postgres:latest'
network_mode
:
host
ports
:
ports
:
-
5432:5432
-
5432:5432
environment
:
environment
:
...
...
src/Gargantext/API.hs
View file @
340d3a46
...
@@ -57,10 +57,12 @@ import Data.Aeson.Encode.Pretty (encodePretty)
...
@@ -57,10 +57,12 @@ import Data.Aeson.Encode.Pretty (encodePretty)
import
Data.Swagger
import
Data.Swagger
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Data.Validity
import
Data.Validity
import
Data.Version
(
showVersion
)
import
GHC.Generics
(
D1
,
Meta
(
..
),
Rep
)
import
GHC.Generics
(
D1
,
Meta
(
..
),
Rep
)
import
GHC.TypeLits
(
AppendSymbol
,
Symbol
)
import
GHC.TypeLits
(
AppendSymbol
,
Symbol
)
import
Network.Wai
import
Network.Wai
import
Network.Wai.Handler.Warp
hiding
(
defaultSettings
)
import
Network.Wai.Handler.Warp
hiding
(
defaultSettings
)
import
qualified
Paths_gargantext
as
PG
-- cabal magic build module
import
Servant
import
Servant
import
Servant.Auth
as
SA
import
Servant.Auth
as
SA
import
Servant.Auth.Server
(
AuthResult
(
..
))
import
Servant.Auth.Server
(
AuthResult
(
..
))
...
@@ -204,6 +206,8 @@ type GargAPI' =
...
@@ -204,6 +206,8 @@ type GargAPI' =
"auth"
:>
Summary
"AUTH API"
"auth"
:>
Summary
"AUTH API"
:>
ReqBody
'[
J
SON
]
AuthRequest
:>
ReqBody
'[
J
SON
]
AuthRequest
:>
Post
'[
J
SON
]
AuthResponse
:>
Post
'[
J
SON
]
AuthResponse
:<|>
"version"
:>
Summary
"Backend version"
:>
Get
'[
J
SON
]
Text
-- TODO-ACCESS here we want to request a particular header for
-- TODO-ACCESS here we want to request a particular header for
-- auth and capabilities.
-- auth and capabilities.
:<|>
GargPrivateAPI
:<|>
GargPrivateAPI
...
@@ -345,9 +349,14 @@ server env = do
...
@@ -345,9 +349,14 @@ server env = do
serverGargAPI
::
GargServerT
env
err
(
GargServerM
env
err
)
GargAPI
serverGargAPI
::
GargServerT
env
err
(
GargServerM
env
err
)
GargAPI
serverGargAPI
-- orchestrator
serverGargAPI
-- orchestrator
=
auth
:<|>
serverPrivateGargAPI
=
auth
:<|>
gargVersion
:<|>
serverPrivateGargAPI
-- :<|> orchestrator
-- :<|> orchestrator
gargVersion
::
GargServer
Text
gargVersion
=
pure
$
(
showVersion
PG
.
version
::
Text
)
serverPrivateGargAPI
::
GargServerT
env
err
(
GargServerM
env
err
)
GargPrivateAPI
serverPrivateGargAPI
::
GargServerT
env
err
(
GargServerM
env
err
)
GargPrivateAPI
serverPrivateGargAPI
(
Authenticated
auser
)
=
serverPrivateGargAPI'
auser
serverPrivateGargAPI
(
Authenticated
auser
)
=
serverPrivateGargAPI'
auser
serverPrivateGargAPI
_
=
throwAll'
(
_ServerError
#
err401
)
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