Merge pull request #9 from vmalepati1/master

Add .env.template and strip newline characters from database URLs
This commit is contained in:
Marc Nijdam 2021-06-29 22:54:09 -06:00 committed by GitHub
commit 71b7f65ce0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

1
.env.template Normal file
View File

@ -0,0 +1 @@
DATABASE_URL=postgresql://user:password@hostname/database

1
.gitignore vendored
View File

@ -18,4 +18,5 @@ _build
rebar3.crashdump
.DS_Store
.env*
!.env.template
.tool-versions

View File

@ -193,7 +193,7 @@ connection_opts(Args, {env, URLName}) ->
DatabaseUrl -> connection_opts(Args, {url, DatabaseUrl})
end;
connection_opts(_Args, {url, DatabaseUrl}) ->
case uri_string:parse(DatabaseUrl) of
case uri_string:parse(string:trim(DatabaseUrl)) of
{error, Error, Term} ->
{error, {Error, Term}};
Map = #{userinfo := UserPass, host := Host, path := Path} ->