Make hostname configurable

This commit is contained in:
Jacky Hu
2016-06-18 10:18:43 +08:00
parent 0e456543bf
commit 563c5fa778
4 changed files with 2 additions and 9 deletions
+1 -4
View File
@@ -19,7 +19,6 @@ import qualified Hasql.Decoders as HD
import qualified Hasql.Encoders as HE
import qualified Hasql.Pool as P
import Network.Wai.Handler.Warp
import Network.BSD (getHostName)
import System.IO (BufferMode (..),
hSetBuffering, stderr,
stdin, stdout)
@@ -47,9 +46,7 @@ main = do
hSetBuffering stdin LineBuffering
hSetBuffering stderr NoBuffering
conf' <- readOptions
host <- getHostName
let conf = conf'{configHost = host}
conf <- readOptions
let port = configPort conf
pgSettings = cs (configDatabase conf)
appSettings = setPort port
-3
View File
@@ -68,7 +68,6 @@ executable postgrest
, insert-ordered-containers >= 0.1.0.1
, http-media >= 0.6.3
, swagger2 >= 2.1
, network >= 2.6.2.1
, HTTP
, Ranged-sets
if !os(windows)
@@ -116,7 +115,6 @@ library
, insert-ordered-containers >= 0.1.0.1
, http-media >= 0.6.3
, swagger2 >= 2.1
, network >= 2.6.2.1
Other-Modules: Paths_postgrest
Exposed-Modules: PostgREST.App
@@ -198,6 +196,5 @@ Test-Suite spec
, insert-ordered-containers
, http-media
, swagger2
, network
, HTTP
, Ranged-sets
+1 -1
View File
@@ -52,7 +52,7 @@ argParser = AppConfig
<$> argument str (help "(REQUIRED) database connection string, e.g. postgres://user:pass@host:port/db" <> metavar "DB_URL")
<*> strOption (long "anonymous" <> short 'a' <> help "(REQUIRED) postgres role to use for non-authenticated requests" <> metavar "ROLE")
<*> strOption (long "schema" <> short 's' <> help "schema to use for API routes" <> metavar "NAME" <> value "public" <> showDefault)
<*> pure "localhost"
<*> strOption (long "hostname" <> short 'n' <> help "hostname on which the HTTP server is running" <> metavar "HOSTNAME" <> value "localhost" <> showDefault)
<*> option auto (long "port" <> short 'p' <> help "port number on which to run HTTP server" <> metavar "PORT" <> value 3000 <> showDefault)
<*> (secret . cs <$>
strOption (long "jwt-secret" <> short 'j' <> help "secret used to encrypt and decrypt JWT tokens" <> metavar "SECRET" <> value "secret" <> showDefault))
-1
View File
@@ -20,7 +20,6 @@ extra-deps:
- insert-ordered-containers-0.1.0.1
- swagger2-2.1
- http-media-0.6.3
- network-2.6.2.1
ghc-options:
postgrest: -O2 -Werror -Wall -fwarn-identities