Documentation

Hale.PostgREST.PostgREST.Config

Logging verbosity level, ordered from most critical to most verbose. $$\text{LogLevel} \in \{ \text{crit}, \text{error}, \text{warn}, \text{info}, \text{debug} \}$$

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      @[implicit_reducible]
      Equations
      @[implicit_reducible]
      Equations
      • One or more equations did not get rendered due to their size.

      Parse a log level from a string (case-insensitive).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        OpenAPI specification generation mode. $$\text{OpenAPIMode} \in \{ \text{followPriv}, \text{ignorePriv}, \text{disabled}, \text{securityNone} \}$$

        • followPriv: respect database privileges in the spec
        • ignorePriv: expose all endpoints regardless of privileges
        • disabled: do not serve the OpenAPI spec
        • securityNone: serve spec with no security definitions
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[implicit_reducible]
            Equations
            • One or more equations did not get rendered due to their size.

            Parse an OpenAPI mode from a string.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              A valid TCP/UDP port number: 1 through 65535. $$\text{Port} = \{ n : \mathbb{N} \mid 0 < n \land n \leq 65535 \}$$ The proof field is erased at runtime (zero cost).

              • val : Nat

                The numeric port value.

              • port_valid : 0 < self.val self.val 65535

                Proof that the port is in the valid range.

              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[implicit_reducible]
                  Equations
                  @[inline]
                  def PostgREST.Config.mkPort (n : Nat) (h : 0 < n n 65535 := by omega) :

                  Create a port from a literal. $$\text{mkPort} : \{ n : \mathbb{N} \mid 0 < n \leq 65535 \} \to \text{Port}$$

                  Equations
                  Instances For

                    The main PostgREST application configuration. $$\text{AppConfig} = \{ \text{dbUri} : \text{String},\; \text{dbSchemas} : [\text{Schema}],\; \text{anonRole} : \text{String},\; \ldots \}$$

                    Each field corresponds to a PostgREST configuration option (e.g., PGRST_DB_URI, PGRST_DB_SCHEMAS).

                    Typing guarantees #

                    • configDbUri : String

                      PostgreSQL connection URI (e.g., postgresql://user:pass@host/db).

                    • Schemas to expose via the API (e.g., ["public"]).

                    • configDbSchemas_nonempty : self.configDbSchemas.length > 0

                      Proof that at least one schema is configured. A PostgREST instance with no schemas cannot serve any requests.

                    • configDbExtraSearchPath : List SchemaCache.Identifiers.Schema

                      Additional schemas to add to the search path.

                    • configDbAnonRole : String

                      The PostgreSQL role for unauthenticated requests.

                    • configDbPreparedStatements : Bool

                      Whether to use prepared statements for queries.

                    • configDbMaxRows : Option Nat

                      Maximum number of rows returned by any request (none = unlimited).

                    • A function to call before every request (for row-level security setup).

                    • Root spec: a function that serves as the API root (/).

                    • configDbTxAllowOverride : Bool

                      Whether clients can override the transaction mode via headers.

                    • configDbTxRollbackAll : Bool

                      Whether to rollback all transactions (useful for testing).

                    • configDbPoolSize : Nat

                      Connection pool size.

                    • configDbPoolSize_pos : self.configDbPoolSize > 0

                      Proof that the pool size is positive (a zero-size pool is useless).

                    • configDbPoolMaxIdleTime : Nat

                      Maximum idle time (seconds) before a pooled connection is closed.

                    • configDbPoolMaxLifetime : Nat

                      Maximum lifetime (seconds) for a pooled connection.

                    • configJwtSecret : Option String

                      JWT secret for token verification.

                    • configJwtSecretIsBase64 : Bool

                      Whether the JWT secret is base64-encoded.

                    • configJwtAudience : Option String

                      Expected JWT audience claim.

                    • configJwtRoleClaimKey : String

                      JSON path to the role claim in the JWT (e.g., .role).

                    • configOpenApiMode : OpenAPIMode

                      OpenAPI specification generation mode.

                    • configOpenApiServerProxyUri : Option String

                      Proxy URI for the OpenAPI server URL.

                    • configServerHost : String

                      Server bind address (!4 = all IPv4, !6 = all IPv6).

                    • configServerPort : Port

                      Server listen port (valid TCP port: 1-65535).

                    • configServerUnixSocket : Option String

                      Unix domain socket path (alternative to TCP).

                    • configServerUnixSocketMode : Nat

                      File mode for the Unix domain socket.

                    • configAdminServerPort : Option Port

                      Admin server port (for health checks and metrics).

                    • configLogLevel : LogLevel

                      Logging verbosity level.

                    • configCorsAllowedOrigins : Option (List String)

                      Allowed CORS origins (none = allow all).

                    • configRawMediaTypes : List String

                      Additional raw media types to accept.

                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        A default configuration suitable for local development and testing. Uses postgresql://localhost/postgres with the public schema.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Whether JWT authentication is configured.

                          Equations
                          Instances For

                            Whether the admin server is enabled.

                            Equations
                            Instances For

                              Whether the API has a root spec function.

                              Equations
                              Instances For

                                Whether the API has a pre-request function.

                                Equations
                                Instances For

                                  The first schema in the exposed schemas list (used as default). Guaranteed to succeed because configDbSchemas is proven non-empty.

                                  Equations
                                  Instances For

                                    LogLevel.parse roundtrips toString for every log level. $$\forall l,\; \text{LogLevel.parse}(\text{toString}(l)) = \text{some}\ l$$

                                    OpenAPIMode.parse roundtrips toString for every mode. $$\forall m,\; \text{OpenAPIMode.parse}(\text{toString}(m)) = \text{some}\ m$$