I know that can add set of docroot in yaws.conf but this not always convenient. Is exist way to start of server from current directory with yaws without modifying configuration file?
Two options:
Keep a template of your yaws.conf
file somewhere and invoke yaws
through a script that first uses the template to create a conf file with the current working directory filled in as docroot
, and then runs yaws
using its --conf
command-line option to specify the newly-created conf file as its configuration file.
Run yaws
in embedded mode, which allows you to programmatically specify the configuration. You can use file:get_cwd/0
to obtain the pathname of the current working directory, then use it as the value for docroot
in the configuration details you pass to yaws_api:embedded_start_conf/1,2,3,4
.