Hello. I'm new to yesod, i recently needed to set an explicit approot to my yesod project through env variables.
I found a dedicated page, but it didnt help me at all. On a scaffolded yesod app, all i had to do was uncommenting a line in /config/setting.yml :
# Default behavior: determine the application root from the request headers.
# Uncomment to set an explicit approot
# approot: "_env:YESOD_APPROOT:http://localhost:3000"
Which is not mentioned on this page.
I'm not sure, is this page dedicated to non-scaffolded apps ? That's not what i understand from those lines but maybe i'm wrong :
Yesod’s scaffolding comes built in with some support for this, most specifically for respecting the APPROOT environment variable to indicate how URLs should be generated, the PORT environment variable for which port to listen for requests on, and database connection settings. (Incidentally, this ties in nicely with the Keter deployment manager.)
The technique for doing this is quite easy: just do the environment variable lookup in your main function. This example demonstrates this technique, along with the slightly special handling necessary for setting the application root.
Even the intention is to explain how to do it "by hand", without scaffolding, maybe mentioning this settings.yml file somewhere in the article could be useful for the readers that used this approach. Just after reading i had no clue how to do it.
I'm up for opening a pull-request if you think some clarifications are welcome.
Hello. I'm new to yesod, i recently needed to set an explicit approot to my yesod project through env variables.
I found a dedicated page, but it didnt help me at all. On a scaffolded yesod app, all i had to do was uncommenting a line in
/config/setting.yml
:Which is not mentioned on this page.
I'm not sure, is this page dedicated to non-scaffolded apps ? That's not what i understand from those lines but maybe i'm wrong :
Even the intention is to explain how to do it "by hand", without scaffolding, maybe mentioning this
settings.yml
file somewhere in the article could be useful for the readers that used this approach. Just after reading i had no clue how to do it.I'm up for opening a pull-request if you think some clarifications are welcome.