Compare commits

...
4 Commits
Author SHA1 Message Date
Joe Nelson 699d6d78dc Bump patch version 2015-02-07 15:27:56 -08:00
Joe Nelson 942ba52f56 Merge branch 'update-deps' 2015-02-07 14:48:26 -08:00
Joe Nelson d77b6df851 Use new optparse-applicative and bcrypt
Fixes #131 and affects #129
2015-02-07 14:21:40 -08:00
Joe Nelson 3662c1d428 Lint and check for restrictive package locks on ci 2015-02-07 13:48:04 -08:00
6 changed files with 33 additions and 22 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ your own projects.
### Usage ### Usage
Download the binary ([OS X](http://bin.begriffs.com/dbapi/osx/postgrest-0.2.5.1.tar.xz) / [Ubuntu](http://bin.begriffs.com/dbapi/heroku/postgrest-0.2.5.1.tar.xz)) and invoke like so: Download the binary ([OS X](http://bin.begriffs.com/dbapi/osx/postgrest-0.2.5.3.tar.xz) / [Linux](http://bin.begriffs.com/dbapi/heroku/postgrest-0.2.5.3.tar.xz)) and invoke like so:
```bash ```bash
postgrest --db-host localhost --db-port 5432 \ postgrest --db-host localhost --db-port 5432 \
+1 -1
View File
@@ -10,7 +10,7 @@
}, },
"POSTGREST_VER": { "POSTGREST_VER": {
"description": "Version of PostgREST to deploy", "description": "Version of PostgREST to deploy",
"value": "0.2.5.1" "value": "0.2.5.3"
}, },
"DB_NAME": { "DB_NAME": {
"description": "Database name", "description": "Database name",
+4
View File
@@ -4,3 +4,7 @@ machine:
- createdb -O postgrest_test -U ubuntu postgrest_test - createdb -O postgrest_test -U ubuntu postgrest_test
ghc: ghc:
version: 7.8.3 version: 7.8.3
test:
post:
- cabal exec hlint src/*.hs test/**/*.hs
- cabal exec packdeps postgrest.cabal
+10 -9
View File
@@ -2,7 +2,7 @@ name: postgrest
description: Reads the schema of a PostgreSQL database and creates RESTful routes description: Reads the schema of a PostgreSQL database and creates RESTful routes
for the tables and views, supporting all HTTP verbs that security for the tables and views, supporting all HTTP verbs that security
permits. permits.
version: 0.2.5.2 version: 0.2.5.3
synopsis: REST API for any Postgres database synopsis: REST API for any Postgres database
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
@@ -32,12 +32,12 @@ executable postgrest
, bytestring, text, split, string-conversions , bytestring, text, split, string-conversions
, stringsearch , stringsearch
, containers, unordered-containers , containers, unordered-containers
, optparse-applicative >= 0.9.1 && < 0.10 , optparse-applicative == 0.11.*
, regex-base, regex-tdfa , regex-base, regex-tdfa
, regex-tdfa-text , regex-tdfa-text
, Ranged-sets , Ranged-sets
, transformers, MissingH , transformers, MissingH
, bcrypt, base64-string , bcrypt >= 0.0.6, base64-string
, network-uri >= 2.6 , network-uri >= 2.6
, resource-pool , resource-pool
, blaze-builder , blaze-builder
@@ -75,15 +75,16 @@ Test-Suite spec
, SpecHelper , SpecHelper
Build-Depends: base, hspec >= 2.1.2, QuickCheck Build-Depends: base, hspec >= 2.1.2, QuickCheck
, hspec-wai >= 0.5.0, hspec-wai-json , hspec-wai >= 0.5.0, hspec-wai-json
, hasql == 0.7.*, hasql-backend , hasql, hasql-backend
, hasql-postgres == 0.10.* , hasql-postgres
, warp >= 3.0.2, wai >= 3.0.1 , warp, wai
, packdeps, hlint
, HTTP, convertible , HTTP, convertible
, case-insensitive , case-insensitive
, wai-extra, wai-cors, containers , wai-extra, wai-cors, containers
, wai-middleware-static >= 0.6.0 , wai-middleware-static
, http-types, scientific, time , http-types, scientific, time
, bytestring, aeson, network >= 2.6 , bytestring, aeson, network
, text, optparse-applicative , text, optparse-applicative
, stringsearch , stringsearch
, unordered-containers , unordered-containers
@@ -94,7 +95,7 @@ Test-Suite spec
, Ranged-sets , Ranged-sets
, transformers, MissingH, split , transformers, MissingH, split
, bcrypt, base64-string , bcrypt, base64-string
, network-uri >= 2.6 , network-uri
, resource-pool , resource-pool
, blaze-builder , blaze-builder
, vector , vector
+9 -9
View File
@@ -24,16 +24,16 @@ data AppConfig = AppConfig {
argParser :: Parser AppConfig argParser :: Parser AppConfig
argParser = AppConfig argParser = AppConfig
<$> strOption (long "db-name" <> short 'd' <> help "name of database") <$> strOption (long "db-name" <> short 'd' <> metavar "NAME" <> help "name of database")
<*> option (long "db-port" <> short 'P' <> value 5432 <> help "postgres server port") <*> option auto (long "db-port" <> short 'P' <> metavar "PORT" <> value 5432 <> help "postgres server port" <> showDefault)
<*> strOption (long "db-user" <> short 'U' <> help "postgres authenticator role") <*> strOption (long "db-user" <> short 'U' <> metavar "ROLE" <> help "postgres authenticator role")
<*> strOption (long "db-pass" <> value "" <> help "password for authenticator role") <*> strOption (long "db-pass" <> metavar "PASS" <> value "" <> help "password for authenticator role")
<*> strOption (long "db-host" <> short 'h' <> value "localhost" <> help "postgres server hostname") <*> strOption (long "db-host" <> metavar "HOST" <> value "localhost" <> help "postgres server hostname" <> showDefault)
<*> option (long "port" <> short 'p' <> value 3000 <> help "port number on which to run HTTP server") <*> option auto (long "port" <> short 'p' <> metavar "PORT" <> value 3000 <> help "port number on which to run HTTP server" <> showDefault)
<*> strOption (long "anonymous" <> short 'a' <> help "postgres role to use for non-authenticated requests") <*> strOption (long "anonymous" <> short 'a' <> metavar "ROLE" <> help "postgres role to use for non-authenticated requests")
<*> switch (long "secure" <> short 's' <> help "Redirect all requests to HTTPS") <*> switch (long "secure" <> short 's' <> help "Redirect all requests to HTTPS")
<*> option (long "db-pool" <> value 10 <> help "Max connections in database pool") <*> option auto (long "db-pool" <> metavar "COUNT" <> value 10 <> help "Max connections in database pool" <> showDefault)
defaultCorsPolicy :: CorsResourcePolicy defaultCorsPolicy :: CorsResourcePolicy
defaultCorsPolicy = CorsResourcePolicy Nothing defaultCorsPolicy = CorsResourcePolicy Nothing
+8 -2
View File
@@ -24,7 +24,14 @@ import Config (AppConfig(..), argParser, corsPolicy)
main :: IO () main :: IO ()
main = do main = do
conf <- execParser (info (helper <*> argParser) describe) let opts = info (helper <*> argParser) $
fullDesc
<> progDesc (
"PostgREST "
<> prettyVersion
<> " / create a REST API to an existing Postgres database"
)
conf <- execParser opts
let port = configPort conf let port = configPort conf
unless (configSecure conf) $ unless (configSecure conf) $
@@ -59,5 +66,4 @@ main = do
either (respond . errResponse) respond resOrError either (respond . errResponse) respond resOrError
where where
describe = progDesc "create a REST API to an existing Postgres database"
prettyVersion = intercalate "." $ map show $ versionBranch version prettyVersion = intercalate "." $ map show $ versionBranch version