vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
146 stars 53 forks source link

Accept URL string in configuration #147

Closed joeyg closed 4 years ago

joeyg commented 4 years ago

When applying the vapor 4.0 docs to use a URL configuration a build error is produced.

For example using: try app.databases.use(.postgres(url: databaseUrl), as: .psql) instead of app.databases.use(.postgres(hostname: "localhost", username: "vapor", password: "vapor", database: "vapor"), as: .psql) creates the following error:

Sources/App/configure.swift:11:65: error: reference to member 'psql' cannot be resolved without a contextual type
        try app.databases.use(.postgres(url: databaseUrl), as: .psql)
tanner0101 commented 4 years ago

I think you may need to convert databaseUrl to Foundation.URL first. We should probably have an overload for String there.

joeyg commented 4 years ago

That was it! Thanks!

tanner0101 commented 4 years ago

This overload exists now :)