/postgresql-provider

PostgreSQL Provider for the Vapor web framework.

Primary LanguageSwiftMIT LicenseMIT

Travis Build

PostgreSQL Provider for Vapor

Adds PostgreSQL support to the Vapor web framework.

Usage

import Vapor
import VaporPostgreSQL

let drop = Droplet()
try drop.addProvider(VaporPostgreSQL.Provider.self)

Config

To build, create a postgresql.json file in the Config/secrets folder. You may need to create the secrets folder if it does not exist. The secrets folder is under the gitignore and shouldn't be committed.

Here's an example Config/secrets/postgresql.json

{
    "host": "127.0.0.1",
    "user": "postgres",
    "password": "",
    "database": "test",
    "port": 5432
}

Or, just set a url.

{
    "url": "psql://user:pass@host:5432/database"
}

Install and link PostgreSQL

Follow the instructions at vapor/postgresql to properly install and link PostgreSQL.