Better environment management

Use an external package for dsn parsing, and minimize the
logic required in the app template