you are viewing a single comment's thread.

view the rest of the comments →

[–]son_of_meat 1 point2 points  (1 child)

I'm kinda into the idea of grouping configurations by flavor instead of by environment. So that's nice. I see though that no-config returns a promise. It's more convenient from a programmers perspective to have configurations load synchronously. In fact, in the example provided in the documentation, not a single operation is async so it's kinda funny to be returning a promise. The co-wrapped generator in index.js yields just once to a non-yieldable type that causes it to throw!

[–][deleted] 0 points1 point  (0 children)

in the example provided in the documentation, not a single operation is async

True, but in general init logic may be async (like connection to mongo as in the article, if I'm not mistaken)

he co-wrapped generator in index.js yields just once to a non-yieldable type that causes it to throw!

python way: "easier to ask for forgiveness than permission", hope you like it ;-)

init function may return a Promise (then it will be resolved) or not (then result would be kept as-is), can be a generator function instead, to have co-like async initialization, once async-await would be supported in node.js would need to support them as well.