postgrest-0.4.2.0: REST API for any Postgres database

Safe Haskell | None
Language | Haskell2010

PostgREST.Config

Description

This module provides a helper function to read the command line arguments using the optparse-applicative and the AppConfig type to store them. It also can be used to define other middleware configuration that may be delegated to some sort of external configuration.

It currently includes a hardcoded CORS policy but this could easly be turned in configurable behaviour if needed.

Other hardcoded options such as the minimum version number also belong here.

Synopsis

- prettyVersion :: Text
- readOptions :: IO AppConfig
- corsPolicy :: Request -> Maybe CorsResourcePolicy
- minimumPgVersion :: PgVersion
- data PgVersion = PgVersion {
  - pgvNum :: Int32
  - pgvName :: Text
  }
- data AppConfig = AppConfig {
  - configDatabase :: Text
  - configAnonRole :: Text
  - configProxyUri :: Maybe Text
  - configSchema :: Text
  - configHost :: Text
  - configPort :: Int
  - configJwtSecret :: Maybe ByteString
  - configJwtSecretIsBase64 :: Bool
  - configPool :: Int
  - configMaxRows :: Maybe Integer
  - configReqCheck :: Maybe Text
  - configQuiet :: Bool
  }

# Documentation

prettyVersion :: Text #

User friendly version number

readOptions :: IO AppConfig #

Function to read and parse options from the command line

corsPolicy :: Request -> Maybe CorsResourcePolicy #

CORS policy to be used in by Wai Cors middleware

minimumPgVersion :: PgVersion #

Tells the minimum PostgreSQL version required by this version of PostgREST

data PgVersion #

Constructors

PgVersion |
Fields pgvNum :: Int32 pgvName :: Text

data AppConfig #

Config file settings for the server

Constructors

AppConfig |
Fields configDatabase :: Text configAnonRole :: Text configProxyUri :: Maybe Text configSchema :: Text configHost :: Text configPort :: Int configJwtSecret :: Maybe ByteString configJwtSecretIsBase64 :: Bool configPool :: Int configMaxRows :: Maybe Integer configReqCheck :: Maybe Text configQuiet :: Bool