Port number is treated as parameters #229

Closed
lulalala opened this Issue Jun 5, 2012 · 3 comments

Projects

None yet

4 participants

@lulalala
lulalala commented Jun 5, 2012

This probably won't be counted as a bug, but I just want to know your opinions:

I have a curl task

job_type :curl, "curl http://localhost:3000/:task :output"

It is used like this curl 'newsletter/deliver'

The problem is that the port number will be stripped out when it is written to crontab.

I am thinking if there is way to escape that, or use a regular expression which will exclude colon+digits (:\d+)

@alexstubbs

Having run into the same problem, can say it's indeed annoying that you can't escape a colon so it doesn't get interpreted. However, escaping "just" digits is non-desirable, rather, being able to escape colons would be preferable.

It can be worked around though, by setting a var equal to the bits you want escaping, so the example above becomes:

set curl_endpoint, "http://localhost:3000"
job_type :curl, "curl :curl_endpoint/:task :output"
@elhu
elhu commented Dec 19, 2012

Wouldn't it be easier to just not interpolate parameters with no corresponding value?
For example, if there is no option with the :3000 key, the key would be left in place.

If this is an acceptable behaviour, I'd be happy to provide a pull-request.

@javan
Owner
javan commented Dec 19, 2012

@elhu good idea!

@javan javan closed this in 6dba273 Dec 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment