forked from erlyaws/yaws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of wildcards and relative paths to load sub-config files.
Now, subconfig and subconfigdir targets accept relative paths, searched relatively to the configuration location. So for the configuration "/etc/yaws/yaws.conf", all relative files and directories will be searched from "/etc/yaws". Of course, absolute paths are always supported. furthermore, the subconfig target can take Unix-style wildcard strings to include several files at once. See filelib:wildcard/1 for details. Last, hidden files, starting by a dot, will be ignored in any cases.
- Loading branch information
Christopher Faulet
committed
Jul 10, 2014
1 parent
90e36db
commit e81c94a
Showing
16 changed files
with
170 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
-module(subconfig). | ||
-compile(export_all). | ||
-include_lib("eunit/include/eunit.hrl"). | ||
|
||
-include("yaws.hrl"). | ||
-include("tftest.hrl"). | ||
|
||
absolute_subconfig_test() -> | ||
Env = #env{debug = false, | ||
conf = {file, ?builddir++"/subconfig_DATA/yaws_absolute.conf"}}, | ||
|
||
{ok, _GC, SCs} = yaws_config:load(Env), | ||
check_sconfs(lists:flatten(SCs)). | ||
|
||
relative_subconfig_test() -> | ||
Env = #env{debug = false, | ||
conf = {file, ?srcdir++"/subconfig_DATA/yaws_relative.conf"}}, | ||
|
||
{ok, _GC, SCs} = yaws_config:load(Env), | ||
check_sconfs(lists:flatten(SCs)). | ||
|
||
check_sconfs(SCs) -> | ||
?assertEqual(5, length(SCs)), | ||
?assert(lists:keymember(80, #sconf.port, SCs)), | ||
?assert(lists:keymember(8001, #sconf.port, SCs)), | ||
?assert(lists:keymember(8002, #sconf.port, SCs)), | ||
?assert(lists:keymember(8003, #sconf.port, SCs)), | ||
?assert(lists:keymember(8004, #sconf.port, SCs)), | ||
ok. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<server vhost_subconfig> | ||
port = 80 | ||
listen = 0.0.0.0 | ||
docroot = /tmp | ||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invalid_param = error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invalid_param = error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<server vhost_subconfigdir1> | ||
port = 8001 | ||
listen = 0.0.0.0 | ||
docroot = /tmp | ||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<server vhost_subconfigdir2> | ||
port = 8002 | ||
listen = 0.0.0.0 | ||
docroot = /tmp | ||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invalid_param = error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<server vhost_subconfigdir1> | ||
port = 8003 | ||
listen = 0.0.0.0 | ||
docroot = /tmp | ||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<server vhost_subconfigdir2> | ||
port = 8004 | ||
listen = 0.0.0.0 | ||
docroot = /tmp | ||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
subconfigdir = @abs_srcdir@/subconfigdir.d | ||
subconfig = @abs_srcdir@/subconfig.conf | ||
subconfig = @abs_srcdir@/subconfig.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
subconfigdir = subconfigdir.d | ||
subconfig = subconfig.conf | ||
subconfig = subconfig.d/*.conf |