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

JS function parameter for backend configuration #48

Open
hedav85 opened this issue Jan 7, 2016 · 3 comments
Open

JS function parameter for backend configuration #48

hedav85 opened this issue Jan 7, 2016 · 3 comments

Comments

@hedav85
Copy link

@hedav85 hedav85 commented Jan 7, 2016

For different backends I have definded JS-functions. This functions are called with two parameters:

req.backend = _.find(config.backend, function(server) {
          if (server.pattern) { return new RegExp(server.pattern).test(req.url); }
          if (server.fn) {
            if (typeof config.functions[server.fn] == 'function') {
              return config.functions[server.fn](req, req.templateVars);
            }
          }
      });

For my situation it would be good to have the current config also as a parameter.

return config.functions[server.fn](req, req.templateVars, server);

Then it is possible for me to add own configurations and to check against them in my JS-function.

What do you think about it?

@cliftonc
Copy link
Member

@cliftonc cliftonc commented Jan 7, 2016

Definitely - its a good idea, and an oversight really. Are you able to submit a PR?

@hedav85
Copy link
Author

@hedav85 hedav85 commented Jan 8, 2016

Yes I'll submit a PR in the next days.

@cliftonc
Copy link
Member

@cliftonc cliftonc commented Jan 12, 2018

@sithmel we should do this.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.