spiral-modules / database

Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders
MIT License
53 stars 19 forks source link

Feature request: Create connection from DSN #58

Closed shyim closed 3 years ago

shyim commented 3 years ago

Almost any cloud provider uses this day env variables like DATABASE_URL. It would be cool, when we just pass that url and get a connection

SerafimArts commented 3 years ago

@shyim why not use getenv('DATABASE_URL') in the db configuration?

shyim commented 3 years ago

Yea after that I have to do parse_url and assemble the config array. It would be fancy to have that out of the box :)

SerafimArts commented 3 years ago

Clear. Good idea.

SerafimArts commented 3 years ago

@shyim sry for the delay. Can you please provide an example of your DSN string?

shyim commented 3 years ago

mysql: mysql://root:root@mysql:3306/sw6

pgsql: postgres://main:main@127.0.0.1:32781/main

SerafimArts commented 3 years ago

@shyim thanks

roxblnfk commented 3 years ago

Feature will be available in the 2.9.0 version.