You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering what are your thoughts about extending current functionality with a possible "cast as dict" feature.
In Django for example, the 'DATABASES' setting varies from deploy to production and it is quite nice and easy (although I admit, a little brute) to just keep the entire db dict as a string in .env file
Can you share your code strategy? I feel this shouldn't be inside decouple, but could be a helper dictionary cast function like Csv.
I have a personal preference for strategies like dj-database-url that converts an URL to a DATABASE dictionary. For quite some time I though about including it as a dependency. However this seems too specific for Django.
To be honest, storing a database as a dict looks really strange and it makes it harder to read the contents of the variable. Imagine someone changing it in a .env file, it wouldn't be that easy. I feel this shouldn't be in decouple too.
You really should be using dj-database-url or multiple variables.
Actually I totally agree. Thanks for dj-database-url, haven't heard of it. Actually the requested feature is totally unnecessary since you can already obtain the desired behaviour by simply passing the literal_eval function as the cast argument. I checked it out afterwards and didn't closed the issue... Sorry
Activity
henriquebastos commentedon Aug 7, 2017
Can you share your code strategy? I feel this shouldn't be inside decouple, but could be a helper
dictionarycast function likeCsv.I have a personal preference for strategies like dj-database-url that converts an URL to a
DATABASEdictionary. For quite some time I though about including it as a dependency. However this seems too specific for Django.heliomeiralins commentedon Aug 8, 2017
@henriquebastos he already implemented it here
To be honest, storing a database as a dict looks really strange and it makes it harder to read the contents of the variable. Imagine someone changing it in a .env file, it wouldn't be that easy. I feel this shouldn't be in decouple too.
You really should be using dj-database-url or multiple variables.
tadeoos commentedon Aug 8, 2017
Actually I totally agree. Thanks for dj-database-url, haven't heard of it. Actually the requested feature is totally unnecessary since you can already obtain the desired behaviour by simply passing the
literal_evalfunction as thecastargument. I checked it out afterwards and didn't closed the issue... Sorryhenriquebastos commentedon Aug 8, 2017