Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router_readconfig: allow 'include' to expand a glob pattern #174

Merged
merged 1 commit into from
May 3, 2016
Merged

router_readconfig: allow 'include' to expand a glob pattern #174

merged 1 commit into from
May 3, 2016

Conversation

iain-buclaw-sociomantic
Copy link
Contributor

@iain-buclaw-sociomantic iain-buclaw-sociomantic commented May 2, 2016

This is an example of what I think would be nice to do. In my relay config have something like:

include /etc/carbon-c-relay/routes.d/*.conf
    ;

And then generate any configuration as needed, which will be loaded by the relay.

Example:

$ cat routes.conf 
include routes.d/*.conf
    ;
$ ls routes.d/
01-cluster.conf  99-matchall.conf
$ ./relay -t -f routes.conf 
[2016-05-02 17:50:45] starting carbon-c-relay v1.11 (6a2f1b), pid=12174
configuration:
    relay hostname = labs-130.sociomantic.com
    listen port = 2003
    workers = 4
    send batch size = 2500
    server queue size = 25000
    statistics submission interval = 60s
    listen backlog = 3
    server connection IO timeout = 600ms
    routes configuration = routes.conf

parsed configuration follows:
cluster test
    any_of
        127.0.0.1:2103
        127.0.0.1:2203
    ;

match *
    send to test
    ;

@grobian
Copy link
Owner

grobian commented May 2, 2016

Question: does glob work when there is nothing to expand? If so, I'd unconditionalise the whole thing and always run through glob.

@iain-buclaw-sociomantic
Copy link
Contributor Author

It could either run out of memory, or fail to read anything because of a permissions error.

I can remove a level of indentation and check for these individual problems separately. I'm also on the border of what to do in the event of no match, whether or not to treat it as an error. However I feel inclined to just ignore it, as per nginx or apache, for example.

@iain-buclaw-sociomantic
Copy link
Contributor Author

iain-buclaw-sociomantic commented May 2, 2016

OK, I've made it check for glob() != 0 && errno != 0, so at the very least OS problems such as permissions errors are reported. The extra indent is gone too.

@grobian
Copy link
Owner

grobian commented May 3, 2016

Did you push your changes somewhere? I'd like to merge them. Description sounds good.

@iain-buclaw-sociomantic
Copy link
Contributor Author

I've rebased and pushed it into this pull.

@grobian grobian merged commit b2088f6 into grobian:master May 3, 2016
grobian added a commit that referenced this pull request May 3, 2016
@iain-buclaw-sociomantic
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants