-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
add support for prepared query templates #296
Conversation
@@ -179,7 +181,12 @@ def flush | |||
}, | |||
"DNS" => { | |||
"TTL" => "#{ttl}s" | |||
}}) | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this should be part of this json should be included no matter what?
What about users of consul before 6.4? What if they don't want to make a template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my testing consul creates the Template hash regardless when a query is created, so sending an empty hash shouldn't affect anything as its not actually a template until Type/Regexp are defined.
That said it will probably fail on < 0.6.4 since it doesn't have templating. I can add some logic into this if you prefer to maintain support for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please.
|
||
newparam(:template_regexp) do | ||
desc 'regexp for template' | ||
validate do |value| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have to have to make this a required argument?
Can you default to nil so that users don't have to provide this all the time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, for sure. I'm somewhat new to ruby types so I'll read the docs a bit more and tweak this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply defaulting to "nil" or whatever and then not injecting template data will make this "automatically" backwards compatible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting a default value to nil causes a failure to compile. Set them to some sane string defaults.
ec414d2
to
3551bab
Compare
I've updated this to add a template parameter, which allows 0.6.3 to work still since its defaulted to false. |
3551bab
to
41bc005
Compare
Any more feedback on this? |
Nope! ty. |
add support for prepared query templates
Expanding on #288 and the good work by @djtaylor, add support for prepared query templates to the custom type.